vendor/v8/src/ic.h in mustang-0.0.1 vs vendor/v8/src/ic.h in mustang-0.1.0
- old
+ new
@@ -84,11 +84,11 @@
EXTRA_CALL_FRAME = 1
};
// Construct the IC structure with the given number of extra
// JavaScript frames on the stack.
- explicit IC(FrameDepth depth);
+ IC(FrameDepth depth, Isolate* isolate);
// Get the call-site target; used for determining the state.
Code* target() { return GetTargetAtAddress(address()); }
inline Address address();
@@ -128,10 +128,11 @@
InlineCacheHolderFlag holder);
protected:
Address fp() const { return fp_; }
Address pc() const { return *pc_address_; }
+ Isolate* isolate() const { return isolate_; }
#ifdef ENABLE_DEBUGGER_SUPPORT
// Computes the address in the original code when the code running is
// containing break points (calls to DebugBreakXXX builtins).
Address OriginalCodeAddress();
@@ -146,14 +147,14 @@
State old_state,
Code* new_target,
const char* extra_info = "");
#endif
- static Failure* TypeError(const char* type,
- Handle<Object> object,
- Handle<Object> key);
- static Failure* ReferenceError(const char* type, Handle<String> name);
+ Failure* TypeError(const char* type,
+ Handle<Object> object,
+ Handle<Object> key);
+ Failure* ReferenceError(const char* type, Handle<String> name);
// Access the target code for the given IC address.
static inline Code* GetTargetAtAddress(Address address);
static inline void SetTargetAtAddress(Address address, Code* target);
@@ -165,10 +166,12 @@
// to make the code GC safe. This feature is crucial since
// GetProperty and SetProperty are called and they in turn might
// invoke the garbage collector.
Address* pc_address_;
+ Isolate* isolate_;
+
DISALLOW_IMPLICIT_CONSTRUCTORS(IC);
};
// An IC_Utility encapsulates IC::UtilityId. It exists mainly because you
@@ -187,11 +190,12 @@
};
class CallICBase: public IC {
protected:
- explicit CallICBase(Code::Kind kind) : IC(EXTRA_CALL_FRAME), kind_(kind) {}
+ CallICBase(Code::Kind kind, Isolate* isolate)
+ : IC(EXTRA_CALL_FRAME, isolate), kind_(kind) {}
public:
MUST_USE_RESULT MaybeObject* LoadFunction(State state,
Code::ExtraICState extra_ic_state,
Handle<Object> object,
@@ -231,11 +235,13 @@
};
class CallIC: public CallICBase {
public:
- CallIC() : CallICBase(Code::CALL_IC) { ASSERT(target()->is_call_stub()); }
+ explicit CallIC(Isolate* isolate) : CallICBase(Code::CALL_IC, isolate) {
+ ASSERT(target()->is_call_stub());
+ }
// Code generator routines.
static void GenerateInitialize(MacroAssembler* masm, int argc) {
GenerateMiss(masm, argc);
}
@@ -245,11 +251,12 @@
};
class KeyedCallIC: public CallICBase {
public:
- KeyedCallIC() : CallICBase(Code::KEYED_CALL_IC) {
+ explicit KeyedCallIC(Isolate* isolate)
+ : CallICBase(Code::KEYED_CALL_IC, isolate) {
ASSERT(target()->is_keyed_call_stub());
}
MUST_USE_RESULT MaybeObject* LoadFunction(State state,
Handle<Object> object,
@@ -265,11 +272,13 @@
};
class LoadIC: public IC {
public:
- LoadIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_load_stub()); }
+ explicit LoadIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) {
+ ASSERT(target()->is_load_stub());
+ }
MUST_USE_RESULT MaybeObject* Load(State state,
Handle<Object> object,
Handle<String> name);
@@ -303,18 +312,21 @@
State state,
Handle<Object> object,
Handle<String> name);
// Stub accessors.
- static Code* megamorphic_stub() {
- return Builtins::builtin(Builtins::LoadIC_Megamorphic);
+ Code* megamorphic_stub() {
+ return isolate()->builtins()->builtin(
+ Builtins::kLoadIC_Megamorphic);
}
static Code* initialize_stub() {
- return Builtins::builtin(Builtins::LoadIC_Initialize);
+ return Isolate::Current()->builtins()->builtin(
+ Builtins::kLoadIC_Initialize);
}
- static Code* pre_monomorphic_stub() {
- return Builtins::builtin(Builtins::LoadIC_PreMonomorphic);
+ Code* pre_monomorphic_stub() {
+ return isolate()->builtins()->builtin(
+ Builtins::kLoadIC_PreMonomorphic);
}
static void Clear(Address address, Code* target);
static bool PatchInlinedLoad(Address address, Object* map, int index);
@@ -328,11 +340,13 @@
};
class KeyedLoadIC: public IC {
public:
- KeyedLoadIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_keyed_load_stub()); }
+ explicit KeyedLoadIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) {
+ ASSERT(target()->is_keyed_load_stub());
+ }
MUST_USE_RESULT MaybeObject* Load(State state,
Handle<Object> object,
Handle<Object> key);
@@ -365,27 +379,33 @@
Handle<Object> object,
Handle<String> name);
// Stub accessors.
static Code* initialize_stub() {
- return Builtins::builtin(Builtins::KeyedLoadIC_Initialize);
+ return Isolate::Current()->builtins()->builtin(
+ Builtins::kKeyedLoadIC_Initialize);
}
- static Code* megamorphic_stub() {
- return Builtins::builtin(Builtins::KeyedLoadIC_Generic);
+ Code* megamorphic_stub() {
+ return isolate()->builtins()->builtin(
+ Builtins::kKeyedLoadIC_Generic);
}
- static Code* generic_stub() {
- return Builtins::builtin(Builtins::KeyedLoadIC_Generic);
+ Code* generic_stub() {
+ return isolate()->builtins()->builtin(
+ Builtins::kKeyedLoadIC_Generic);
}
- static Code* pre_monomorphic_stub() {
- return Builtins::builtin(Builtins::KeyedLoadIC_PreMonomorphic);
+ Code* pre_monomorphic_stub() {
+ return isolate()->builtins()->builtin(
+ Builtins::kKeyedLoadIC_PreMonomorphic);
}
- static Code* string_stub() {
- return Builtins::builtin(Builtins::KeyedLoadIC_String);
+ Code* string_stub() {
+ return isolate()->builtins()->builtin(
+ Builtins::kKeyedLoadIC_String);
}
- static Code* indexed_interceptor_stub() {
- return Builtins::builtin(Builtins::KeyedLoadIC_IndexedInterceptor);
+ Code* indexed_interceptor_stub() {
+ return isolate()->builtins()->builtin(
+ Builtins::kKeyedLoadIC_IndexedInterceptor);
}
static void Clear(Address address, Code* target);
// Support for patching the map that is checked in an inlined
@@ -396,32 +416,29 @@
};
class StoreIC: public IC {
public:
+ explicit StoreIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) {
+ ASSERT(target()->is_store_stub());
+ }
- enum StoreICStrictMode {
- kStoreICNonStrict = kNonStrictMode,
- kStoreICStrict = kStrictMode
- };
-
- StoreIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_store_stub()); }
-
MUST_USE_RESULT MaybeObject* Store(State state,
- Code::ExtraICState extra_ic_state,
+ StrictModeFlag strict_mode,
Handle<Object> object,
Handle<String> name,
Handle<Object> value);
// Code generators for stub routines. Only called once at startup.
static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
static void GenerateMiss(MacroAssembler* masm);
static void GenerateMegamorphic(MacroAssembler* masm,
- Code::ExtraICState extra_ic_state);
+ StrictModeFlag strict_mode);
static void GenerateArrayLength(MacroAssembler* masm);
static void GenerateNormal(MacroAssembler* masm);
- static void GenerateGlobalProxy(MacroAssembler* masm);
+ static void GenerateGlobalProxy(MacroAssembler* masm,
+ StrictModeFlag strict_mode);
// Clear the use of an inlined version.
static void ClearInlinedVersion(Address address);
// The offset from the inlined patch site to the start of the
@@ -431,33 +448,46 @@
private:
// Update the inline cache and the global stub cache based on the
// lookup result.
void UpdateCaches(LookupResult* lookup,
State state,
- Code::ExtraICState extra_ic_state,
+ StrictModeFlag strict_mode,
Handle<JSObject> receiver,
Handle<String> name,
Handle<Object> value);
+ void set_target(Code* code) {
+ // Strict mode must be preserved across IC patching.
+ ASSERT((code->extra_ic_state() & kStrictMode) ==
+ (target()->extra_ic_state() & kStrictMode));
+ IC::set_target(code);
+ }
+
// Stub accessors.
- static Code* megamorphic_stub() {
- return Builtins::builtin(Builtins::StoreIC_Megamorphic);
+ Code* megamorphic_stub() {
+ return isolate()->builtins()->builtin(
+ Builtins::kStoreIC_Megamorphic);
}
- static Code* megamorphic_stub_strict() {
- return Builtins::builtin(Builtins::StoreIC_Megamorphic_Strict);
+ Code* megamorphic_stub_strict() {
+ return isolate()->builtins()->builtin(
+ Builtins::kStoreIC_Megamorphic_Strict);
}
static Code* initialize_stub() {
- return Builtins::builtin(Builtins::StoreIC_Initialize);
+ return Isolate::Current()->builtins()->builtin(
+ Builtins::kStoreIC_Initialize);
}
static Code* initialize_stub_strict() {
- return Builtins::builtin(Builtins::StoreIC_Initialize_Strict);
+ return Isolate::Current()->builtins()->builtin(
+ Builtins::kStoreIC_Initialize_Strict);
}
- static Code* global_proxy_stub() {
- return Builtins::builtin(Builtins::StoreIC_GlobalProxy);
+ Code* global_proxy_stub() {
+ return isolate()->builtins()->builtin(
+ Builtins::kStoreIC_GlobalProxy);
}
- static Code* global_proxy_stub_strict() {
- return Builtins::builtin(Builtins::StoreIC_GlobalProxy_Strict);
+ Code* global_proxy_stub_strict() {
+ return isolate()->builtins()->builtin(
+ Builtins::kStoreIC_GlobalProxy_Strict);
}
static void Clear(Address address, Code* target);
// Support for patching the index and the map that is checked in an
@@ -468,22 +498,24 @@
};
class KeyedStoreIC: public IC {
public:
- KeyedStoreIC() : IC(NO_EXTRA_FRAME) { }
+ explicit KeyedStoreIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) { }
MUST_USE_RESULT MaybeObject* Store(State state,
+ StrictModeFlag strict_mode,
Handle<Object> object,
Handle<Object> name,
Handle<Object> value);
// Code generators for stub routines. Only called once at startup.
static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
static void GenerateMiss(MacroAssembler* masm);
- static void GenerateRuntimeSetProperty(MacroAssembler* masm);
- static void GenerateGeneric(MacroAssembler* masm);
+ static void GenerateRuntimeSetProperty(MacroAssembler* masm,
+ StrictModeFlag strict_mode);
+ static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode);
// Clear the inlined version so the IC is always hit.
static void ClearInlinedVersion(Address address);
// Restore the inlined version so the fast case can get hit.
@@ -491,24 +523,47 @@
private:
// Update the inline cache.
void UpdateCaches(LookupResult* lookup,
State state,
+ StrictModeFlag strict_mode,
Handle<JSObject> receiver,
Handle<String> name,
Handle<Object> value);
+ void set_target(Code* code) {
+ // Strict mode must be preserved across IC patching.
+ ASSERT((code->extra_ic_state() & kStrictMode) ==
+ (target()->extra_ic_state() & kStrictMode));
+ IC::set_target(code);
+ }
+
// Stub accessors.
static Code* initialize_stub() {
- return Builtins::builtin(Builtins::KeyedStoreIC_Initialize);
+ return Isolate::Current()->builtins()->builtin(
+ Builtins::kKeyedStoreIC_Initialize);
}
- static Code* megamorphic_stub() {
- return Builtins::builtin(Builtins::KeyedStoreIC_Generic);
+ Code* megamorphic_stub() {
+ return isolate()->builtins()->builtin(
+ Builtins::kKeyedStoreIC_Generic);
}
- static Code* generic_stub() {
- return Builtins::builtin(Builtins::KeyedStoreIC_Generic);
+ static Code* initialize_stub_strict() {
+ return Isolate::Current()->builtins()->builtin(
+ Builtins::kKeyedStoreIC_Initialize_Strict);
}
+ Code* megamorphic_stub_strict() {
+ return isolate()->builtins()->builtin(
+ Builtins::kKeyedStoreIC_Generic_Strict);
+ }
+ Code* generic_stub() {
+ return isolate()->builtins()->builtin(
+ Builtins::kKeyedStoreIC_Generic);
+ }
+ Code* generic_stub_strict() {
+ return isolate()->builtins()->builtin(
+ Builtins::kKeyedStoreIC_Generic_Strict);
+ }
static void Clear(Address address, Code* target);
// Support for patching the map that is checked in an inlined
// version of keyed store.
@@ -532,11 +587,11 @@
HEAP_NUMBERS, // Both arguments are HeapNumbers.
STRINGS, // At least one of the arguments is String.
GENERIC // Non-specialized case (processes any type combination).
};
- BinaryOpIC() : IC(NO_EXTRA_FRAME) { }
+ explicit BinaryOpIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) { }
void patch(Code* code);
static const char* GetName(TypeInfo type_info);
@@ -553,15 +608,16 @@
enum TypeInfo {
UNINITIALIZED,
SMI,
INT32,
HEAP_NUMBER,
+ ODDBALL,
STRING, // Only used for addition operation. At least one string operand.
GENERIC
};
- TRBinaryOpIC() : IC(NO_EXTRA_FRAME) { }
+ explicit TRBinaryOpIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) { }
void patch(Code* code);
static const char* GetName(TypeInfo type_info);
@@ -581,10 +637,11 @@
HEAP_NUMBERS,
OBJECTS,
GENERIC
};
- explicit CompareIC(Token::Value op) : IC(EXTRA_CALL_FRAME), op_(op) { }
+ CompareIC(Isolate* isolate, Token::Value op)
+ : IC(EXTRA_CALL_FRAME, isolate), op_(op) { }
// Update the inline cache for the given operands.
void UpdateCaches(Handle<Object> x, Handle<Object> y);
// Factory method for getting an uninitialized compare stub.