diff options
Diffstat (limited to 'JavaScriptCore/interpreter')
-rw-r--r-- | JavaScriptCore/interpreter/Interpreter.cpp | 23 | ||||
-rw-r--r-- | JavaScriptCore/interpreter/RegisterFile.cpp | 17 | ||||
-rw-r--r-- | JavaScriptCore/interpreter/RegisterFile.h | 9 |
3 files changed, 45 insertions, 4 deletions
diff --git a/JavaScriptCore/interpreter/Interpreter.cpp b/JavaScriptCore/interpreter/Interpreter.cpp index 40f6458..e53f236 100644 --- a/JavaScriptCore/interpreter/Interpreter.cpp +++ b/JavaScriptCore/interpreter/Interpreter.cpp @@ -3211,6 +3211,29 @@ skip_id_custom_self: vPC += OPCODE_LENGTH(op_jnlesseq); NEXT_INSTRUCTION(); } + DEFINE_OPCODE(op_jlesseq) { + /* jlesseq src1(r) src2(r) target(offset) + + Checks whether register src1 is less than or equal to + register src2, as with the ECMAScript '<=' operator, + and then jumps to offset target from the current instruction, + if and only if the result of the comparison is true. + */ + JSValue src1 = callFrame->r(vPC[1].u.operand).jsValue(); + JSValue src2 = callFrame->r(vPC[2].u.operand).jsValue(); + int target = vPC[3].u.operand; + + bool result = jsLessEq(callFrame, src1, src2); + CHECK_FOR_EXCEPTION(); + + if (result) { + vPC += target; + NEXT_INSTRUCTION(); + } + + vPC += OPCODE_LENGTH(op_jlesseq); + NEXT_INSTRUCTION(); + } DEFINE_OPCODE(op_switch_imm) { /* switch_imm tableIndex(n) defaultOffset(offset) scrutinee(r) diff --git a/JavaScriptCore/interpreter/RegisterFile.cpp b/JavaScriptCore/interpreter/RegisterFile.cpp index 510effe..63ea5b3 100644 --- a/JavaScriptCore/interpreter/RegisterFile.cpp +++ b/JavaScriptCore/interpreter/RegisterFile.cpp @@ -29,6 +29,8 @@ #include "config.h" #include "RegisterFile.h" +#include "JSGlobalObject.h" + namespace JSC { RegisterFile::~RegisterFile() @@ -56,4 +58,19 @@ void RegisterFile::releaseExcessCapacity() m_maxUsed = m_start; } +void RegisterFile::setGlobalObject(JSGlobalObject* globalObject) +{ + m_globalObject = globalObject; +} + +bool RegisterFile::clearGlobalObject(JSGlobalObject* globalObject) +{ + return m_globalObject.clear(globalObject); +} + +JSGlobalObject* RegisterFile::globalObject() +{ + return m_globalObject.get(); +} + } // namespace JSC diff --git a/JavaScriptCore/interpreter/RegisterFile.h b/JavaScriptCore/interpreter/RegisterFile.h index 1fc4f82..def9e25 100644 --- a/JavaScriptCore/interpreter/RegisterFile.h +++ b/JavaScriptCore/interpreter/RegisterFile.h @@ -32,6 +32,7 @@ #include "Collector.h" #include "ExecutableAllocator.h" #include "Register.h" +#include "WeakGCPtr.h" #include <stdio.h> #include <wtf/Noncopyable.h> #include <wtf/VMTags.h> @@ -124,8 +125,9 @@ namespace JSC { Register* end() const { return m_end; } size_t size() const { return m_end - m_start; } - void setGlobalObject(JSGlobalObject* globalObject) { m_globalObject = globalObject; } - JSGlobalObject* globalObject() { return m_globalObject; } + void setGlobalObject(JSGlobalObject*); + bool clearGlobalObject(JSGlobalObject*); + JSGlobalObject* globalObject(); bool grow(Register* newEnd); void shrink(Register* newEnd); @@ -153,7 +155,7 @@ namespace JSC { Register* m_commitEnd; #endif - JSGlobalObject* m_globalObject; // The global object whose vars are currently stored in the register file. + WeakGCPtr<JSGlobalObject> m_globalObject; // The global object whose vars are currently stored in the register file. }; // FIXME: Add a generic getpagesize() to WTF, then move this function to WTF as well. @@ -166,7 +168,6 @@ namespace JSC { , m_end(0) , m_max(0) , m_buffer(0) - , m_globalObject(0) { // Verify that our values will play nice with mmap and VirtualAlloc. ASSERT(isPageAligned(maxGlobals)); |