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

Side by Side Diff: src/lookup.h

Issue 1704353002: [runtime] Force internalize names used before lookup in in DescriptorArray and TransitionArray (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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/json-parser.h ('k') | src/lookup.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 #ifndef V8_LOOKUP_H_ 5 #ifndef V8_LOOKUP_H_
6 #define V8_LOOKUP_H_ 6 #define V8_LOOKUP_H_
7 7
8 #include "src/factory.h" 8 #include "src/factory.h"
9 #include "src/isolate.h" 9 #include "src/isolate.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 BEFORE_PROPERTY = INTERCEPTOR 44 BEFORE_PROPERTY = INTERCEPTOR
45 }; 45 };
46 46
47 LookupIterator(Handle<Object> receiver, Handle<Name> name, 47 LookupIterator(Handle<Object> receiver, Handle<Name> name,
48 Configuration configuration = DEFAULT) 48 Configuration configuration = DEFAULT)
49 : configuration_(ComputeConfiguration(configuration, name)), 49 : configuration_(ComputeConfiguration(configuration, name)),
50 state_(NOT_FOUND), 50 state_(NOT_FOUND),
51 interceptor_state_(InterceptorState::kUninitialized), 51 interceptor_state_(InterceptorState::kUninitialized),
52 property_details_(PropertyDetails::Empty()), 52 property_details_(PropertyDetails::Empty()),
53 isolate_(name->GetIsolate()), 53 isolate_(name->GetIsolate()),
54 name_(Name::Flatten(name)), 54 name_(isolate_->factory()->InternalizeName(name)),
55 // kMaxUInt32 isn't a valid index. 55 // kMaxUInt32 isn't a valid index.
56 index_(kMaxUInt32), 56 index_(kMaxUInt32),
57 receiver_(receiver), 57 receiver_(receiver),
58 holder_(GetRoot(isolate_, receiver)), 58 holder_(GetRoot(isolate_, receiver)),
59 initial_holder_(holder_), 59 initial_holder_(holder_),
60 number_(DescriptorArray::kNotFound) { 60 number_(DescriptorArray::kNotFound) {
61 #ifdef DEBUG 61 #ifdef DEBUG
62 uint32_t index; // Assert that the name is not an array index. 62 uint32_t index; // Assert that the name is not an array index.
63 DCHECK(!name->AsArrayIndex(&index)); 63 DCHECK(!name->AsArrayIndex(&index));
64 #endif // DEBUG 64 #endif // DEBUG
65 Next(); 65 Next();
66 } 66 }
67 67
68 LookupIterator(Handle<Object> receiver, Handle<Name> name, 68 LookupIterator(Handle<Object> receiver, Handle<Name> name,
69 Handle<JSReceiver> holder, 69 Handle<JSReceiver> holder,
70 Configuration configuration = DEFAULT) 70 Configuration configuration = DEFAULT)
71 : configuration_(ComputeConfiguration(configuration, name)), 71 : configuration_(ComputeConfiguration(configuration, name)),
72 state_(NOT_FOUND), 72 state_(NOT_FOUND),
73 interceptor_state_(InterceptorState::kUninitialized), 73 interceptor_state_(InterceptorState::kUninitialized),
74 property_details_(PropertyDetails::Empty()), 74 property_details_(PropertyDetails::Empty()),
75 isolate_(name->GetIsolate()), 75 isolate_(name->GetIsolate()),
76 name_(Name::Flatten(name)), 76 name_(isolate_->factory()->InternalizeName(name)),
77 // kMaxUInt32 isn't a valid index. 77 // kMaxUInt32 isn't a valid index.
78 index_(kMaxUInt32), 78 index_(kMaxUInt32),
79 receiver_(receiver), 79 receiver_(receiver),
80 holder_(holder), 80 holder_(holder),
81 initial_holder_(holder_), 81 initial_holder_(holder_),
82 number_(DescriptorArray::kNotFound) { 82 number_(DescriptorArray::kNotFound) {
83 #ifdef DEBUG 83 #ifdef DEBUG
84 uint32_t index; // Assert that the name is not an array index. 84 uint32_t index; // Assert that the name is not an array index.
85 DCHECK(!name->AsArrayIndex(&index)); 85 DCHECK(!name->AsArrayIndex(&index));
86 #endif // DEBUG 86 #endif // DEBUG
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 initial_holder_(holder_), 120 initial_holder_(holder_),
121 number_(DescriptorArray::kNotFound) { 121 number_(DescriptorArray::kNotFound) {
122 // kMaxUInt32 isn't a valid index. 122 // kMaxUInt32 isn't a valid index.
123 DCHECK_NE(kMaxUInt32, index_); 123 DCHECK_NE(kMaxUInt32, index_);
124 Next(); 124 Next();
125 } 125 }
126 126
127 static LookupIterator PropertyOrElement( 127 static LookupIterator PropertyOrElement(
128 Isolate* isolate, Handle<Object> receiver, Handle<Name> name, 128 Isolate* isolate, Handle<Object> receiver, Handle<Name> name,
129 Configuration configuration = DEFAULT) { 129 Configuration configuration = DEFAULT) {
130 name = Name::Flatten(name); 130 name = isolate->factory()->InternalizeName(name);
131 uint32_t index; 131 uint32_t index;
132 LookupIterator it = 132 LookupIterator it =
133 name->AsArrayIndex(&index) 133 name->AsArrayIndex(&index)
134 ? LookupIterator(isolate, receiver, index, configuration) 134 ? LookupIterator(isolate, receiver, index, configuration)
135 : LookupIterator(receiver, name, configuration); 135 : LookupIterator(receiver, name, configuration);
136 it.name_ = name; 136 it.name_ = name;
137 return it; 137 return it;
138 } 138 }
139 139
140 static LookupIterator PropertyOrElement( 140 static LookupIterator PropertyOrElement(
141 Isolate* isolate, Handle<Object> receiver, Handle<Name> name, 141 Isolate* isolate, Handle<Object> receiver, Handle<Name> name,
142 Handle<JSReceiver> holder, Configuration configuration = DEFAULT) { 142 Handle<JSReceiver> holder, Configuration configuration = DEFAULT) {
143 name = Name::Flatten(name); 143 name = isolate->factory()->InternalizeName(name);
144 uint32_t index; 144 uint32_t index;
145 LookupIterator it = 145 LookupIterator it =
146 name->AsArrayIndex(&index) 146 name->AsArrayIndex(&index)
147 ? LookupIterator(isolate, receiver, index, holder, configuration) 147 ? LookupIterator(isolate, receiver, index, holder, configuration)
148 : LookupIterator(receiver, name, holder, configuration); 148 : LookupIterator(receiver, name, holder, configuration);
149 it.name_ = name; 149 it.name_ = name;
150 return it; 150 return it;
151 } 151 }
152 152
153 static LookupIterator PropertyOrElement( 153 static LookupIterator PropertyOrElement(
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 int GetAccessorIndex() const; 249 int GetAccessorIndex() const;
250 int GetConstantIndex() const; 250 int GetConstantIndex() const;
251 Handle<PropertyCell> GetPropertyCell() const; 251 Handle<PropertyCell> GetPropertyCell() const;
252 Handle<Object> GetAccessors() const; 252 Handle<Object> GetAccessors() const;
253 inline Handle<InterceptorInfo> GetInterceptor() const { 253 inline Handle<InterceptorInfo> GetInterceptor() const {
254 DCHECK_EQ(INTERCEPTOR, state_); 254 DCHECK_EQ(INTERCEPTOR, state_);
255 return handle(GetInterceptor(JSObject::cast(*holder_)), isolate_); 255 return handle(GetInterceptor(JSObject::cast(*holder_)), isolate_);
256 } 256 }
257 Handle<Object> GetDataValue() const; 257 Handle<Object> GetDataValue() const;
258 void WriteDataValue(Handle<Object> value); 258 void WriteDataValue(Handle<Object> value);
259 void InternalizeName();
260 259
261 private: 260 private:
262 enum class InterceptorState { 261 enum class InterceptorState {
263 kUninitialized, 262 kUninitialized,
264 kSkipNonMasking, 263 kSkipNonMasking,
265 kProcessNonMasking 264 kProcessNonMasking
266 }; 265 };
267 266
268 Handle<Map> GetReceiverMap() const; 267 Handle<Map> GetReceiverMap() const;
269 268
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 Handle<JSReceiver> holder_; 335 Handle<JSReceiver> holder_;
337 const Handle<JSReceiver> initial_holder_; 336 const Handle<JSReceiver> initial_holder_;
338 uint32_t number_; 337 uint32_t number_;
339 }; 338 };
340 339
341 340
342 } // namespace internal 341 } // namespace internal
343 } // namespace v8 342 } // namespace v8
344 343
345 #endif // V8_LOOKUP_H_ 344 #endif // V8_LOOKUP_H_
OLDNEW
« no previous file with comments | « src/json-parser.h ('k') | src/lookup.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698