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

Unified Diff: src/runtime/runtime-classes.cc

Issue 649603003: Keyed stores to super with numeric keys. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 6 years, 2 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 | « src/objects.cc ('k') | test/mjsunit/harmony/super.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-classes.cc
diff --git a/src/runtime/runtime-classes.cc b/src/runtime/runtime-classes.cc
index 5b1cfe328ace509e3434579f99b6b77f5afe9d47..15a08b0cc179a83448ab0ab7c3b2582a89de1915 100644
--- a/src/runtime/runtime-classes.cc
+++ b/src/runtime/runtime-classes.cc
@@ -287,6 +287,30 @@ static Object* StoreToSuper(Isolate* isolate, Handle<JSObject> home_object,
}
+static Object* StoreElementToSuper(Isolate* isolate,
+ Handle<JSObject> home_object,
+ Handle<Object> receiver, uint32_t index,
+ Handle<Object> value,
+ StrictMode strict_mode) {
+ if (home_object->IsAccessCheckNeeded() &&
+ !isolate->MayIndexedAccess(home_object, index, v8::ACCESS_SET)) {
+ isolate->ReportFailedAccessCheck(home_object, v8::ACCESS_SET);
+ RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
+ }
+
+ PrototypeIterator iter(isolate, home_object);
+ Handle<Object> proto = PrototypeIterator::GetCurrent(iter);
+ if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value();
+
+ Handle<Object> result;
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, result,
+ Object::SetElementWithReceiver(isolate, proto, receiver, index, value,
+ strict_mode));
+ return *result;
+}
+
+
RUNTIME_FUNCTION(Runtime_StoreToSuper_Strict) {
HandleScope scope(isolate);
DCHECK(args.length() == 4);
@@ -314,13 +338,18 @@ RUNTIME_FUNCTION(Runtime_StoreToSuper_Sloppy) {
static Object* StoreKeyedToSuper(Isolate* isolate, Handle<JSObject> home_object,
Handle<Object> receiver, Handle<Object> key,
Handle<Object> value, StrictMode strict_mode) {
+ uint32_t index;
+
+ if (key->ToArrayIndex(&index)) {
+ return StoreElementToSuper(isolate, home_object, receiver, index, value,
+ strict_mode);
+ }
Handle<Name> name;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name,
Runtime::ToName(isolate, key));
- uint32_t index;
if (name->AsArrayIndex(&index)) {
- // TODO(dslomov): Implement.
- return ThrowUnsupportedSuper(isolate);
+ return StoreElementToSuper(isolate, home_object, receiver, index, value,
+ strict_mode);
}
return StoreToSuper(isolate, home_object, receiver, name, value, strict_mode);
}
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/harmony/super.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698