Index: src/stub-cache.cc |
diff --git a/src/stub-cache.cc b/src/stub-cache.cc |
index abb26d6ed423a6c231ae288baa37fa18bc498a86..5e7efaa9ee4cc1949d0cafa658321295d3cb2847 100644 |
--- a/src/stub-cache.cc |
+++ b/src/stub-cache.cc |
@@ -498,13 +498,13 @@ MaybeObject* StubCache::ComputeStoreField(String* name, |
JSObject* receiver, |
int field_index, |
Map* transition, |
- Code::ExtraICState extra_ic_state) { |
+ StrictModeFlag strict_mode) { |
PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; |
Code::Flags flags = Code::ComputeMonomorphicFlags( |
- Code::STORE_IC, type, extra_ic_state); |
+ Code::STORE_IC, type, strict_mode); |
Object* code = receiver->map()->FindInCodeCache(name, flags); |
if (code->IsUndefined()) { |
- StoreStubCompiler compiler(extra_ic_state); |
+ StoreStubCompiler compiler(strict_mode); |
{ MaybeObject* maybe_code = |
compiler.CompileStoreField(receiver, field_index, transition, name); |
if (!maybe_code->ToObject(&code)) return maybe_code; |
@@ -521,13 +521,15 @@ MaybeObject* StubCache::ComputeStoreField(String* name, |
} |
-MaybeObject* StubCache::ComputeKeyedStoreSpecialized(JSObject* receiver) { |
+MaybeObject* StubCache::ComputeKeyedStoreSpecialized( |
+ JSObject* receiver, |
+ StrictModeFlag strict_mode) { |
Code::Flags flags = |
- Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, NORMAL); |
+ Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, NORMAL, strict_mode); |
String* name = Heap::KeyedStoreSpecialized_symbol(); |
Object* code = receiver->map()->FindInCodeCache(name, flags); |
if (code->IsUndefined()) { |
- KeyedStoreStubCompiler compiler; |
+ KeyedStoreStubCompiler compiler(strict_mode); |
{ MaybeObject* maybe_code = compiler.CompileStoreSpecialized(receiver); |
if (!maybe_code->ToObject(&code)) return maybe_code; |
} |
@@ -542,7 +544,9 @@ MaybeObject* StubCache::ComputeKeyedStoreSpecialized(JSObject* receiver) { |
} |
-MaybeObject* StubCache::ComputeKeyedStorePixelArray(JSObject* receiver) { |
+MaybeObject* StubCache::ComputeKeyedStorePixelArray( |
+ JSObject* receiver, |
+ StrictModeFlag strict_mode) { |
// 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 |
@@ -550,11 +554,11 @@ MaybeObject* StubCache::ComputeKeyedStorePixelArray(JSObject* receiver) { |
// 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); |
+ Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, NORMAL, strict_mode); |
String* name = Heap::KeyedStorePixelArray_symbol(); |
Object* code = receiver->map()->FindInCodeCache(name, flags); |
if (code->IsUndefined()) { |
- KeyedStoreStubCompiler compiler; |
+ KeyedStoreStubCompiler compiler(strict_mode); |
{ MaybeObject* maybe_code = compiler.CompileStorePixelArray(receiver); |
if (!maybe_code->ToObject(&code)) return maybe_code; |
} |
@@ -598,11 +602,13 @@ ExternalArrayType ElementsKindToExternalArrayType(JSObject::ElementsKind kind) { |
MaybeObject* StubCache::ComputeKeyedLoadOrStoreExternalArray( |
JSObject* receiver, |
- bool is_store) { |
+ bool is_store, |
+ StrictModeFlag strict_mode) { |
Code::Flags flags = |
Code::ComputeMonomorphicFlags( |
is_store ? Code::KEYED_STORE_IC : Code::KEYED_LOAD_IC, |
- NORMAL); |
+ NORMAL, |
+ strict_mode); |
ExternalArrayType array_type = |
ElementsKindToExternalArrayType(receiver->GetElementsKind()); |
String* name = |
@@ -615,9 +621,9 @@ MaybeObject* StubCache::ComputeKeyedLoadOrStoreExternalArray( |
Object* code = map->FindInCodeCache(name, flags); |
if (code->IsUndefined()) { |
ExternalArrayStubCompiler compiler; |
- { MaybeObject* maybe_code = |
- is_store ? compiler.CompileKeyedStoreStub(array_type, flags) : |
- compiler.CompileKeyedLoadStub(array_type, flags); |
+ { MaybeObject* maybe_code = is_store |
+ ? compiler.CompileKeyedStoreStub(array_type, flags) |
+ : compiler.CompileKeyedLoadStub(array_type, flags); |
if (!maybe_code->ToObject(&code)) return maybe_code; |
} |
if (is_store) { |
@@ -637,8 +643,8 @@ MaybeObject* StubCache::ComputeKeyedLoadOrStoreExternalArray( |
} |
-MaybeObject* StubCache::ComputeStoreNormal(Code::ExtraICState extra_ic_state) { |
- return Builtins::builtin(extra_ic_state == StoreIC::kStoreICStrict |
+MaybeObject* StubCache::ComputeStoreNormal(StrictModeFlag strict_mode) { |
+ return Builtins::builtin(strict_mode == kStrictMode |
? Builtins::StoreIC_Normal_Strict |
: Builtins::StoreIC_Normal); |
} |
@@ -647,12 +653,12 @@ MaybeObject* StubCache::ComputeStoreNormal(Code::ExtraICState extra_ic_state) { |
MaybeObject* StubCache::ComputeStoreGlobal(String* name, |
GlobalObject* receiver, |
JSGlobalPropertyCell* cell, |
- Code::ExtraICState extra_ic_state) { |
+ StrictModeFlag strict_mode) { |
Code::Flags flags = Code::ComputeMonomorphicFlags( |
- Code::STORE_IC, NORMAL, extra_ic_state); |
+ Code::STORE_IC, NORMAL, strict_mode); |
Object* code = receiver->map()->FindInCodeCache(name, flags); |
if (code->IsUndefined()) { |
- StoreStubCompiler compiler(extra_ic_state); |
+ StoreStubCompiler compiler(strict_mode); |
{ MaybeObject* maybe_code = |
compiler.CompileStoreGlobal(receiver, cell, name); |
if (!maybe_code->ToObject(&code)) return maybe_code; |
@@ -673,13 +679,13 @@ MaybeObject* StubCache::ComputeStoreCallback( |
String* name, |
JSObject* receiver, |
AccessorInfo* callback, |
- Code::ExtraICState extra_ic_state) { |
+ StrictModeFlag strict_mode) { |
ASSERT(v8::ToCData<Address>(callback->setter()) != 0); |
Code::Flags flags = Code::ComputeMonomorphicFlags( |
- Code::STORE_IC, CALLBACKS, extra_ic_state); |
+ Code::STORE_IC, CALLBACKS, strict_mode); |
Object* code = receiver->map()->FindInCodeCache(name, flags); |
if (code->IsUndefined()) { |
- StoreStubCompiler compiler(extra_ic_state); |
+ StoreStubCompiler compiler(strict_mode); |
{ MaybeObject* maybe_code = |
compiler.CompileStoreCallback(receiver, callback, name); |
if (!maybe_code->ToObject(&code)) return maybe_code; |
@@ -699,12 +705,12 @@ MaybeObject* StubCache::ComputeStoreCallback( |
MaybeObject* StubCache::ComputeStoreInterceptor( |
String* name, |
JSObject* receiver, |
- Code::ExtraICState extra_ic_state) { |
+ StrictModeFlag strict_mode) { |
Code::Flags flags = Code::ComputeMonomorphicFlags( |
- Code::STORE_IC, INTERCEPTOR, extra_ic_state); |
+ Code::STORE_IC, INTERCEPTOR, strict_mode); |
Object* code = receiver->map()->FindInCodeCache(name, flags); |
if (code->IsUndefined()) { |
- StoreStubCompiler compiler(extra_ic_state); |
+ StoreStubCompiler compiler(strict_mode); |
{ MaybeObject* maybe_code = |
compiler.CompileStoreInterceptor(receiver, name); |
if (!maybe_code->ToObject(&code)) return maybe_code; |
@@ -724,12 +730,14 @@ MaybeObject* StubCache::ComputeStoreInterceptor( |
MaybeObject* StubCache::ComputeKeyedStoreField(String* name, |
JSObject* receiver, |
int field_index, |
- Map* transition) { |
+ Map* transition, |
+ StrictModeFlag strict_mode) { |
PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; |
- Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, type); |
+ Code::Flags flags = Code::ComputeMonomorphicFlags( |
+ Code::KEYED_STORE_IC, type, strict_mode); |
Object* code = receiver->map()->FindInCodeCache(name, flags); |
if (code->IsUndefined()) { |
- KeyedStoreStubCompiler compiler; |
+ KeyedStoreStubCompiler compiler(strict_mode); |
{ MaybeObject* maybe_code = |
compiler.CompileStoreField(receiver, field_index, transition, name); |
if (!maybe_code->ToObject(&code)) return maybe_code; |
@@ -1275,7 +1283,7 @@ MaybeObject* StoreCallbackProperty(Arguments args) { |
CustomArguments custom_args(callback->data(), recv, recv); |
v8::AccessorInfo info(custom_args.end()); |
{ |
- // Leaving JavaScript. |
+ // Leaving JavaScript. TODO(mmaly): Do we need strict mode here? |
VMState state(EXTERNAL); |
ExternalCallbackScope call_scope(setter_address); |
fun(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info); |
@@ -1417,12 +1425,17 @@ MaybeObject* LoadPropertyWithInterceptorForCall(Arguments args) { |
MaybeObject* StoreInterceptorProperty(Arguments args) { |
+ ASSERT(args.length() == 4); |
JSObject* recv = JSObject::cast(args[0]); |
String* name = String::cast(args[1]); |
Object* value = args[2]; |
+ StrictModeFlag strict = |
+ static_cast<StrictModeFlag>(Smi::cast(args[3])->value()); |
+ ASSERT(strict == kStrictMode || strict == kNonStrictMode); |
ASSERT(recv->HasNamedInterceptor()); |
PropertyAttributes attr = NONE; |
- MaybeObject* result = recv->SetPropertyWithInterceptor(name, value, attr); |
+ MaybeObject* result = recv->SetPropertyWithInterceptor( |
+ name, value, attr, strict); |
return result; |
} |
@@ -1675,8 +1688,8 @@ MaybeObject* KeyedLoadStubCompiler::GetCode(PropertyType type, String* name) { |
MaybeObject* StoreStubCompiler::GetCode(PropertyType type, String* name) { |
- Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, type, |
- extra_ic_state_); |
+ Code::Flags flags = Code::ComputeMonomorphicFlags( |
+ Code::STORE_IC, type, strict_mode_); |
MaybeObject* result = GetCodeWithFlags(flags, name); |
if (!result->IsFailure()) { |
PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, |
@@ -1691,7 +1704,8 @@ MaybeObject* StoreStubCompiler::GetCode(PropertyType type, String* name) { |
MaybeObject* KeyedStoreStubCompiler::GetCode(PropertyType type, String* name) { |
- Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, type); |
+ Code::Flags flags = Code::ComputeMonomorphicFlags( |
+ Code::KEYED_STORE_IC, type, strict_mode_); |
MaybeObject* result = GetCodeWithFlags(flags, name); |
if (!result->IsFailure()) { |
PROFILE(CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, |