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

Side by Side Diff: src/builtins/builtins-object-gen.cc

Issue 2811333002: [builtins] HasOwnProperty: handle non-internalized string keys (Closed)
Patch Set: fix Created 3 years, 8 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
OLDNEW
1 // Copyright 2017 the V8 project authors. All rights reserved. 1 // Copyright 2017 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/builtins/builtins-utils-gen.h" 5 #include "src/builtins/builtins-utils-gen.h"
6 #include "src/builtins/builtins.h" 6 #include "src/builtins/builtins.h"
7 #include "src/code-stub-assembler.h" 7 #include "src/code-stub-assembler.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 Branch(TaggedIsSmi(object), &return_false, &if_objectisnotsmi); 61 Branch(TaggedIsSmi(object), &return_false, &if_objectisnotsmi);
62 BIND(&if_objectisnotsmi); 62 BIND(&if_objectisnotsmi);
63 63
64 Node* map = LoadMap(object); 64 Node* map = LoadMap(object);
65 Node* instance_type = LoadMapInstanceType(map); 65 Node* instance_type = LoadMapInstanceType(map);
66 66
67 { 67 {
68 VARIABLE(var_index, MachineType::PointerRepresentation()); 68 VARIABLE(var_index, MachineType::PointerRepresentation());
69 VARIABLE(var_unique, MachineRepresentation::kTagged); 69 VARIABLE(var_unique, MachineRepresentation::kTagged);
70 70
71 Label keyisindex(this), if_iskeyunique(this); 71 Label if_index(this), if_unique_name(this), if_notunique_name(this);
72 TryToName(key, &keyisindex, &var_index, &if_iskeyunique, &var_unique, 72 TryToName(key, &if_index, &var_index, &if_unique_name, &var_unique,
73 &call_runtime); 73 &call_runtime, &if_notunique_name);
74 74
75 BIND(&if_iskeyunique); 75 BIND(&if_unique_name);
76 TryHasOwnProperty(object, map, instance_type, var_unique.value(), 76 TryHasOwnProperty(object, map, instance_type, var_unique.value(),
77 &return_true, &return_false, &call_runtime); 77 &return_true, &return_false, &call_runtime);
78 78
79 BIND(&keyisindex); 79 BIND(&if_index);
80 // Handle negative keys in the runtime. 80 {
81 GotoIf(IntPtrLessThan(var_index.value(), IntPtrConstant(0)), &call_runtime); 81 // Handle negative keys in the runtime.
82 TryLookupElement(object, map, instance_type, var_index.value(), 82 GotoIf(IntPtrLessThan(var_index.value(), IntPtrConstant(0)),
83 &return_true, &return_false, &return_false, &call_runtime); 83 &call_runtime);
84 TryLookupElement(object, map, instance_type, var_index.value(),
85 &return_true, &return_false, &return_false,
86 &call_runtime);
87 }
88
89 BIND(&if_notunique_name);
90 {
91 Node* function = ExternalConstant(
92 ExternalReference::try_internalize_string_function(isolate()));
93 Node* result = CallCFunction1(MachineType::AnyTagged(),
94 MachineType::AnyTagged(), function, key);
95 // If internalization failed, then the string did not exist in the string
96 // table yet, which implies that no existing object has a property with
97 // that name.
98 Label internalized(this);
99 GotoIf(TaggedIsNotSmi(result), &internalized);
100 Node* int_result = SmiUntag(result);
101 GotoIf(WordEqual(int_result, IntPtrConstant(ResultSentinel::kNotFound)),
102 &return_false);
103 GotoIf(
104 WordEqual(int_result, IntPtrConstant(ResultSentinel::kUnsupported)),
105 &call_runtime);
106 var_index.Bind(int_result);
107 Goto(&if_index);
108
109 BIND(&internalized);
110 var_unique.Bind(result);
111 Goto(&if_unique_name);
112 }
84 } 113 }
85 BIND(&return_true); 114 BIND(&return_true);
86 Return(BooleanConstant(true)); 115 Return(BooleanConstant(true));
87 116
88 BIND(&return_false); 117 BIND(&return_false);
89 Return(BooleanConstant(false)); 118 Return(BooleanConstant(false));
90 119
91 BIND(&call_runtime); 120 BIND(&call_runtime);
92 Return(CallRuntime(Runtime::kObjectHasOwnProperty, context, object, key)); 121 Return(CallRuntime(Runtime::kObjectHasOwnProperty, context, object, key));
93 } 122 }
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 424
396 TF_BUILTIN(GetSuperConstructor, ObjectBuiltinsAssembler) { 425 TF_BUILTIN(GetSuperConstructor, ObjectBuiltinsAssembler) {
397 Node* object = Parameter(Descriptor::kObject); 426 Node* object = Parameter(Descriptor::kObject);
398 Node* context = Parameter(Descriptor::kContext); 427 Node* context = Parameter(Descriptor::kContext);
399 428
400 Return(GetSuperConstructor(object, context)); 429 Return(GetSuperConstructor(object, context));
401 } 430 }
402 431
403 } // namespace internal 432 } // namespace internal
404 } // namespace v8 433 } // namespace v8
OLDNEW
« no previous file with comments | « src/assembler.cc ('k') | src/code-stub-assembler.h » ('j') | src/ic/accessor-assembler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698