diff options
Diffstat (limited to 'deps/v8/src/stub-cache.cc')
-rw-r--r-- | deps/v8/src/stub-cache.cc | 77 |
1 files changed, 58 insertions, 19 deletions
diff --git a/deps/v8/src/stub-cache.cc b/deps/v8/src/stub-cache.cc index 731714138..abb26d6ed 100644 --- a/deps/v8/src/stub-cache.cc +++ b/deps/v8/src/stub-cache.cc @@ -497,12 +497,14 @@ MaybeObject* StubCache::ComputeKeyedLoadPixelArray(JSObject* receiver) { MaybeObject* StubCache::ComputeStoreField(String* name, JSObject* receiver, int field_index, - Map* transition) { + Map* transition, + Code::ExtraICState extra_ic_state) { PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; - Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, type); + Code::Flags flags = Code::ComputeMonomorphicFlags( + Code::STORE_IC, type, extra_ic_state); Object* code = receiver->map()->FindInCodeCache(name, flags); if (code->IsUndefined()) { - StoreStubCompiler compiler; + StoreStubCompiler compiler(extra_ic_state); { MaybeObject* maybe_code = compiler.CompileStoreField(receiver, field_index, transition, name); if (!maybe_code->ToObject(&code)) return maybe_code; @@ -540,6 +542,33 @@ MaybeObject* StubCache::ComputeKeyedStoreSpecialized(JSObject* receiver) { } +MaybeObject* StubCache::ComputeKeyedStorePixelArray(JSObject* receiver) { + // Using NORMAL as the PropertyType for array element stores is a misuse. The + // generated stub always accesses fast elements, not slow-mode fields, but + // some property type is required for the stub lookup. Note that overloading + // the NORMAL PropertyType is only safe as long as no stubs are generated for + // other keyed field stores. This is guaranteed to be the case since all field + // keyed stores that are not array elements go through a generic builtin stub. + Code::Flags flags = + Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, NORMAL); + String* name = Heap::KeyedStorePixelArray_symbol(); + Object* code = receiver->map()->FindInCodeCache(name, flags); + if (code->IsUndefined()) { + KeyedStoreStubCompiler compiler; + { MaybeObject* maybe_code = compiler.CompileStorePixelArray(receiver); + if (!maybe_code->ToObject(&code)) return maybe_code; + } + PROFILE(CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), 0)); + Object* result; + { MaybeObject* maybe_result = + receiver->UpdateMapCodeCache(name, Code::cast(code)); + if (!maybe_result->ToObject(&result)) return maybe_result; + } + } + return code; +} + + namespace { ExternalArrayType ElementsKindToExternalArrayType(JSObject::ElementsKind kind) { @@ -608,18 +637,22 @@ MaybeObject* StubCache::ComputeKeyedLoadOrStoreExternalArray( } -MaybeObject* StubCache::ComputeStoreNormal() { - return Builtins::builtin(Builtins::StoreIC_Normal); +MaybeObject* StubCache::ComputeStoreNormal(Code::ExtraICState extra_ic_state) { + return Builtins::builtin(extra_ic_state == StoreIC::kStoreICStrict + ? Builtins::StoreIC_Normal_Strict + : Builtins::StoreIC_Normal); } MaybeObject* StubCache::ComputeStoreGlobal(String* name, GlobalObject* receiver, - JSGlobalPropertyCell* cell) { - Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL); + JSGlobalPropertyCell* cell, + Code::ExtraICState extra_ic_state) { + Code::Flags flags = Code::ComputeMonomorphicFlags( + Code::STORE_IC, NORMAL, extra_ic_state); Object* code = receiver->map()->FindInCodeCache(name, flags); if (code->IsUndefined()) { - StoreStubCompiler compiler; + StoreStubCompiler compiler(extra_ic_state); { MaybeObject* maybe_code = compiler.CompileStoreGlobal(receiver, cell, name); if (!maybe_code->ToObject(&code)) return maybe_code; @@ -636,14 +669,17 @@ MaybeObject* StubCache::ComputeStoreGlobal(String* name, } -MaybeObject* StubCache::ComputeStoreCallback(String* name, - JSObject* receiver, - AccessorInfo* callback) { +MaybeObject* StubCache::ComputeStoreCallback( + String* name, + JSObject* receiver, + AccessorInfo* callback, + Code::ExtraICState extra_ic_state) { ASSERT(v8::ToCData<Address>(callback->setter()) != 0); - Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, CALLBACKS); + Code::Flags flags = Code::ComputeMonomorphicFlags( + Code::STORE_IC, CALLBACKS, extra_ic_state); Object* code = receiver->map()->FindInCodeCache(name, flags); if (code->IsUndefined()) { - StoreStubCompiler compiler; + StoreStubCompiler compiler(extra_ic_state); { MaybeObject* maybe_code = compiler.CompileStoreCallback(receiver, callback, name); if (!maybe_code->ToObject(&code)) return maybe_code; @@ -660,13 +696,15 @@ MaybeObject* StubCache::ComputeStoreCallback(String* name, } -MaybeObject* StubCache::ComputeStoreInterceptor(String* name, - JSObject* receiver) { - Code::Flags flags = - Code::ComputeMonomorphicFlags(Code::STORE_IC, INTERCEPTOR); +MaybeObject* StubCache::ComputeStoreInterceptor( + String* name, + JSObject* receiver, + Code::ExtraICState extra_ic_state) { + Code::Flags flags = Code::ComputeMonomorphicFlags( + Code::STORE_IC, INTERCEPTOR, extra_ic_state); Object* code = receiver->map()->FindInCodeCache(name, flags); if (code->IsUndefined()) { - StoreStubCompiler compiler; + StoreStubCompiler compiler(extra_ic_state); { MaybeObject* maybe_code = compiler.CompileStoreInterceptor(receiver, name); if (!maybe_code->ToObject(&code)) return maybe_code; @@ -1637,7 +1675,8 @@ MaybeObject* KeyedLoadStubCompiler::GetCode(PropertyType type, String* name) { MaybeObject* StoreStubCompiler::GetCode(PropertyType type, String* name) { - Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, type); + Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, type, + extra_ic_state_); MaybeObject* result = GetCodeWithFlags(flags, name); if (!result->IsFailure()) { PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, |