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

Side by Side Diff: src/runtime/runtime-classes.cc

Issue 1178893002: Introduce LookupIterator::PropertyOrElement which converts name to index if possible. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « src/objects-inl.h ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/arguments.h" 10 #include "src/arguments.h"
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 CONVERT_ARG_HANDLE_CHECKED(Object, key, 2); 300 CONVERT_ARG_HANDLE_CHECKED(Object, key, 2);
301 301
302 uint32_t index = 0; 302 uint32_t index = 0;
303 if (key->ToArrayIndex(&index)) { 303 if (key->ToArrayIndex(&index)) {
304 return LoadElementFromSuper(isolate, receiver, home_object, index); 304 return LoadElementFromSuper(isolate, receiver, home_object, index);
305 } 305 }
306 306
307 Handle<Name> name; 307 Handle<Name> name;
308 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name, 308 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name,
309 Runtime::ToName(isolate, key)); 309 Runtime::ToName(isolate, key));
310 // TODO(verwaest): Unify using LookupIterator.
310 if (name->AsArrayIndex(&index)) { 311 if (name->AsArrayIndex(&index)) {
311 return LoadElementFromSuper(isolate, receiver, home_object, index); 312 return LoadElementFromSuper(isolate, receiver, home_object, index);
312 } 313 }
313 return LoadFromSuper(isolate, receiver, home_object, name); 314 return LoadFromSuper(isolate, receiver, home_object, name);
314 } 315 }
315 316
316 317
317 static Object* StoreToSuper(Isolate* isolate, Handle<JSObject> home_object, 318 static Object* StoreToSuper(Isolate* isolate, Handle<JSObject> home_object,
318 Handle<Object> receiver, Handle<Name> name, 319 Handle<Object> receiver, Handle<Name> name,
319 Handle<Object> value, LanguageMode language_mode) { 320 Handle<Object> value, LanguageMode language_mode) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 LanguageMode language_mode) { 391 LanguageMode language_mode) {
391 uint32_t index = 0; 392 uint32_t index = 0;
392 393
393 if (key->ToArrayIndex(&index)) { 394 if (key->ToArrayIndex(&index)) {
394 return StoreElementToSuper(isolate, home_object, receiver, index, value, 395 return StoreElementToSuper(isolate, home_object, receiver, index, value,
395 language_mode); 396 language_mode);
396 } 397 }
397 Handle<Name> name; 398 Handle<Name> name;
398 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name, 399 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name,
399 Runtime::ToName(isolate, key)); 400 Runtime::ToName(isolate, key));
401 // TODO(verwaest): Unify using LookupIterator.
400 if (name->AsArrayIndex(&index)) { 402 if (name->AsArrayIndex(&index)) {
401 return StoreElementToSuper(isolate, home_object, receiver, index, value, 403 return StoreElementToSuper(isolate, home_object, receiver, index, value,
402 language_mode); 404 language_mode);
403 } 405 }
404 return StoreToSuper(isolate, home_object, receiver, name, value, 406 return StoreToSuper(isolate, home_object, receiver, name, value,
405 language_mode); 407 language_mode);
406 } 408 }
407 409
408 410
409 RUNTIME_FUNCTION(Runtime_StoreKeyedToSuper_Strict) { 411 RUNTIME_FUNCTION(Runtime_StoreKeyedToSuper_Strict) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 return nullptr; 450 return nullptr;
449 } 451 }
450 452
451 453
452 RUNTIME_FUNCTION(Runtime_CallSuperWithSpread) { 454 RUNTIME_FUNCTION(Runtime_CallSuperWithSpread) {
453 UNIMPLEMENTED(); 455 UNIMPLEMENTED();
454 return nullptr; 456 return nullptr;
455 } 457 }
456 } // namespace internal 458 } // namespace internal
457 } // namespace v8 459 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698