Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Unified Diff: src/elements.cc

Issue 1233493007: Update the context if Set on slow-mode argument targets an aliased arguments entry (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/test262-es6/test262-es6.status » ('j') | test/test262-es6/test262-es6.status » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/elements.cc
diff --git a/src/elements.cc b/src/elements.cc
index 1e1b7b6392a1764e1453f7ccd0f7688771f145b1..8dca4a4a0a4b70b43fdc9754204be0c078fed256 100644
--- a/src/elements.cc
+++ b/src/elements.cc
@@ -930,11 +930,14 @@ class DictionaryElementsAccessor
obj->set_elements(*new_elements);
}
+ static Object* GetRaw(FixedArrayBase* store, uint32_t entry) {
+ SeededNumberDictionary* backing_store = SeededNumberDictionary::cast(store);
+ return backing_store->ValueAt(entry);
+ }
+
static Handle<Object> GetImpl(Handle<FixedArrayBase> store, uint32_t entry) {
- Handle<SeededNumberDictionary> backing_store =
- Handle<SeededNumberDictionary>::cast(store);
- Isolate* isolate = backing_store->GetIsolate();
- return handle(backing_store->ValueAt(entry), isolate);
+ Isolate* isolate = store->GetIsolate();
+ return handle(GetRaw(*store, entry), isolate);
}
static void SetImpl(FixedArrayBase* store, uint32_t entry, Object* value) {
@@ -1175,6 +1178,12 @@ class FastSmiOrObjectElementsAccessor
: FastElementsAccessor<FastElementsAccessorSubclass,
KindTraits>(name) {}
+ static Object* GetRaw(FixedArray* backing_store, uint32_t entry) {
+ uint32_t index = FastElementsAccessorSubclass::GetIndexForEntryImpl(
+ backing_store, entry);
+ return backing_store->get(index);
+ }
+
// NOTE: this method violates the handlified function signature convention:
// raw pointer parameters in the function that allocates.
// See ElementsAccessor::CopyElements() for details.
@@ -1445,9 +1454,9 @@ class SloppyArgumentsElementsAccessor
// Elements of the arguments object in slow mode might be slow aliases.
if (result->IsAliasedArgumentsEntry()) {
DisallowHeapAllocation no_gc;
- AliasedArgumentsEntry* entry = AliasedArgumentsEntry::cast(*result);
+ AliasedArgumentsEntry* alias = AliasedArgumentsEntry::cast(*result);
Context* context = Context::cast(parameter_map->get(0));
- int context_entry = entry->aliased_context_slot();
+ int context_entry = alias->aliased_context_slot();
DCHECK(!context->get(context_entry)->IsTheHole());
return handle(context->get(context_entry), isolate);
}
@@ -1471,7 +1480,16 @@ class SloppyArgumentsElementsAccessor
context->set(context_entry, value);
} else {
FixedArray* arguments = FixedArray::cast(parameter_map->get(1));
- ArgumentsAccessor::SetImpl(arguments, entry - length, value);
+ Object* current = ArgumentsAccessor::GetRaw(arguments, entry - length);
+ if (current->IsAliasedArgumentsEntry()) {
+ AliasedArgumentsEntry* alias = AliasedArgumentsEntry::cast(current);
+ Context* context = Context::cast(parameter_map->get(0));
+ int context_entry = alias->aliased_context_slot();
+ DCHECK(!context->get(context_entry)->IsTheHole());
+ context->set(context_entry, value);
+ } else {
+ ArgumentsAccessor::SetImpl(arguments, entry - length, value);
+ }
}
}
« no previous file with comments | « no previous file | test/test262-es6/test262-es6.status » ('j') | test/test262-es6/test262-es6.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698