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

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

Issue 1317033009: [runtime] Remove Runtime::KeyedGetObjectProperty function. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-super-default-construct-2
Patch Set: Created 5 years, 3 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/runtime/runtime.h ('k') | no next file » | 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 "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // TODO(verwaest): Make sure GetProperty(LookupIterator*) can handle this, and 42 // TODO(verwaest): Make sure GetProperty(LookupIterator*) can handle this, and
43 // remove the special casing here. 43 // remove the special casing here.
44 if (name->AsArrayIndex(&index)) { 44 if (name->AsArrayIndex(&index)) {
45 return Object::GetElement(isolate, object, index); 45 return Object::GetElement(isolate, object, index);
46 } else { 46 } else {
47 return Object::GetProperty(object, name, language_mode); 47 return Object::GetProperty(object, name, language_mode);
48 } 48 }
49 } 49 }
50 50
51 51
52 MaybeHandle<Object> Runtime::KeyedGetObjectProperty( 52 static MaybeHandle<Object> KeyedGetObjectProperty(Isolate* isolate,
53 Isolate* isolate, Handle<Object> receiver_obj, Handle<Object> key_obj, 53 Handle<Object> receiver_obj,
54 LanguageMode language_mode) { 54 Handle<Object> key_obj,
55 LanguageMode language_mode) {
55 // Fast cases for getting named properties of the receiver JSObject 56 // Fast cases for getting named properties of the receiver JSObject
56 // itself. 57 // itself.
57 // 58 //
58 // The global proxy objects has to be excluded since LookupOwn on 59 // The global proxy objects has to be excluded since LookupOwn on
59 // the global proxy object can return a valid result even though the 60 // the global proxy object can return a valid result even though the
60 // global proxy object never has properties. This is the case 61 // global proxy object never has properties. This is the case
61 // because the global proxy object forwards everything to its hidden 62 // because the global proxy object forwards everything to its hidden
62 // prototype including own lookups. 63 // prototype including own lookups.
63 // 64 //
64 // Additionally, we need to make sure that we do not cache results 65 // Additionally, we need to make sure that we do not cache results
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 Handle<String> str = Handle<String>::cast(receiver_obj); 119 Handle<String> str = Handle<String>::cast(receiver_obj);
119 int index = Handle<Smi>::cast(key_obj)->value(); 120 int index = Handle<Smi>::cast(key_obj)->value();
120 if (index >= 0 && index < str->length()) { 121 if (index >= 0 && index < str->length()) {
121 Factory* factory = isolate->factory(); 122 Factory* factory = isolate->factory();
122 return factory->LookupSingleCharacterStringFromCode( 123 return factory->LookupSingleCharacterStringFromCode(
123 String::Flatten(str)->Get(index)); 124 String::Flatten(str)->Get(index));
124 } 125 }
125 } 126 }
126 127
127 // Fall back to GetObjectProperty. 128 // Fall back to GetObjectProperty.
128 return GetObjectProperty(isolate, receiver_obj, key_obj, language_mode); 129 return Runtime::GetObjectProperty(isolate, receiver_obj, key_obj,
130 language_mode);
129 } 131 }
130 132
131 133
132 MaybeHandle<Object> Runtime::DeleteObjectProperty(Isolate* isolate, 134 MaybeHandle<Object> Runtime::DeleteObjectProperty(Isolate* isolate,
133 Handle<JSReceiver> receiver, 135 Handle<JSReceiver> receiver,
134 Handle<Object> key, 136 Handle<Object> key,
135 LanguageMode language_mode) { 137 LanguageMode language_mode) {
136 // Check if the given key is an array index. 138 // Check if the given key is an array index.
137 uint32_t index = 0; 139 uint32_t index = 0;
138 if (key->ToArrayIndex(&index)) { 140 if (key->ToArrayIndex(&index)) {
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 RUNTIME_FUNCTION(Runtime_KeyedGetProperty) { 515 RUNTIME_FUNCTION(Runtime_KeyedGetProperty) {
514 HandleScope scope(isolate); 516 HandleScope scope(isolate);
515 DCHECK(args.length() == 2); 517 DCHECK(args.length() == 2);
516 518
517 CONVERT_ARG_HANDLE_CHECKED(Object, receiver_obj, 0); 519 CONVERT_ARG_HANDLE_CHECKED(Object, receiver_obj, 0);
518 CONVERT_ARG_HANDLE_CHECKED(Object, key_obj, 1); 520 CONVERT_ARG_HANDLE_CHECKED(Object, key_obj, 1);
519 521
520 Handle<Object> result; 522 Handle<Object> result;
521 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 523 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
522 isolate, result, 524 isolate, result,
523 Runtime::KeyedGetObjectProperty(isolate, receiver_obj, key_obj, SLOPPY)); 525 KeyedGetObjectProperty(isolate, receiver_obj, key_obj, SLOPPY));
524 return *result; 526 return *result;
525 } 527 }
526 528
527 529
528 RUNTIME_FUNCTION(Runtime_KeyedGetPropertyStrong) { 530 RUNTIME_FUNCTION(Runtime_KeyedGetPropertyStrong) {
529 HandleScope scope(isolate); 531 HandleScope scope(isolate);
530 DCHECK(args.length() == 2); 532 DCHECK(args.length() == 2);
531 533
532 CONVERT_ARG_HANDLE_CHECKED(Object, receiver_obj, 0); 534 CONVERT_ARG_HANDLE_CHECKED(Object, receiver_obj, 0);
533 CONVERT_ARG_HANDLE_CHECKED(Object, key_obj, 1); 535 CONVERT_ARG_HANDLE_CHECKED(Object, key_obj, 1);
534 536
535 Handle<Object> result; 537 Handle<Object> result;
536 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 538 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
537 isolate, result, 539 isolate, result,
538 Runtime::KeyedGetObjectProperty(isolate, receiver_obj, key_obj, STRONG)); 540 KeyedGetObjectProperty(isolate, receiver_obj, key_obj, STRONG));
539 return *result; 541 return *result;
540 } 542 }
541 543
542 544
543 RUNTIME_FUNCTION(Runtime_AddNamedProperty) { 545 RUNTIME_FUNCTION(Runtime_AddNamedProperty) {
544 HandleScope scope(isolate); 546 HandleScope scope(isolate);
545 RUNTIME_ASSERT(args.length() == 4); 547 RUNTIME_ASSERT(args.length() == 4);
546 548
547 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); 549 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
548 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); 550 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1554 RUNTIME_FUNCTION(Runtime_CreateIterResultObject) { 1556 RUNTIME_FUNCTION(Runtime_CreateIterResultObject) {
1555 HandleScope scope(isolate); 1557 HandleScope scope(isolate);
1556 DCHECK_EQ(2, args.length()); 1558 DCHECK_EQ(2, args.length());
1557 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); 1559 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0);
1558 CONVERT_ARG_HANDLE_CHECKED(Object, done, 1); 1560 CONVERT_ARG_HANDLE_CHECKED(Object, done, 1);
1559 return *isolate->factory()->NewJSIteratorResult(value, done); 1561 return *isolate->factory()->NewJSIteratorResult(value, done);
1560 } 1562 }
1561 1563
1562 } // namespace internal 1564 } // namespace internal
1563 } // namespace v8 1565 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698