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

Side by Side Diff: src/lookup.cc

Issue 804993002: Internalize strings being stored into uninitialized property cells (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comment Created 6 years 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/lookup.h ('k') | src/objects.h » ('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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/deoptimizer.h" 8 #include "src/deoptimizer.h"
9 #include "src/lookup.h" 9 #include "src/lookup.h"
10 #include "src/lookup-inl.h" 10 #include "src/lookup-inl.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 282 }
283 283
284 284
285 Handle<Object> LookupIterator::GetDataValue() const { 285 Handle<Object> LookupIterator::GetDataValue() const {
286 DCHECK_EQ(DATA, state_); 286 DCHECK_EQ(DATA, state_);
287 Handle<Object> value = FetchValue(); 287 Handle<Object> value = FetchValue();
288 return value; 288 return value;
289 } 289 }
290 290
291 291
292 void LookupIterator::WriteDataValue(Handle<Object> value) { 292 Handle<Object> LookupIterator::WriteDataValue(Handle<Object> value) {
293 DCHECK_EQ(DATA, state_); 293 DCHECK_EQ(DATA, state_);
294 Handle<JSObject> holder = GetHolder<JSObject>(); 294 Handle<JSObject> holder = GetHolder<JSObject>();
295 if (holder_map_->is_dictionary_map()) { 295 if (holder_map_->is_dictionary_map()) {
296 NameDictionary* property_dictionary = holder->property_dictionary(); 296 NameDictionary* property_dictionary = holder->property_dictionary();
297 if (holder->IsGlobalObject()) { 297 if (holder->IsGlobalObject()) {
298 Handle<PropertyCell> cell( 298 Handle<PropertyCell> cell(
299 PropertyCell::cast(property_dictionary->ValueAt(dictionary_entry()))); 299 PropertyCell::cast(property_dictionary->ValueAt(dictionary_entry())));
300 PropertyCell::SetValueInferType(cell, value); 300 value = PropertyCell::SetValueInferType(cell, value);
301 } else { 301 } else {
302 property_dictionary->ValueAtPut(dictionary_entry(), *value); 302 property_dictionary->ValueAtPut(dictionary_entry(), *value);
303 } 303 }
304 } else if (property_details_.type() == v8::internal::FIELD) { 304 } else if (property_details_.type() == v8::internal::FIELD) {
305 holder->WriteToField(descriptor_number(), *value); 305 holder->WriteToField(descriptor_number(), *value);
306 } else { 306 } else {
307 DCHECK_EQ(v8::internal::CONSTANT, property_details_.type()); 307 DCHECK_EQ(v8::internal::CONSTANT, property_details_.type());
308 } 308 }
309 return value;
309 } 310 }
310 311
311 312
312 bool LookupIterator::IsSpecialNumericIndex() const { 313 bool LookupIterator::IsSpecialNumericIndex() const {
313 if (GetStoreTarget()->IsJSTypedArray() && name()->IsString()) { 314 if (GetStoreTarget()->IsJSTypedArray() && name()->IsString()) {
314 Handle<String> name_string = Handle<String>::cast(name()); 315 Handle<String> name_string = Handle<String>::cast(name());
315 if (name_string->length() > 0) { 316 if (name_string->length() > 0) {
316 double d = 317 double d =
317 StringToDouble(isolate()->unicode_cache(), name_string, NO_FLAGS); 318 StringToDouble(isolate()->unicode_cache(), name_string, NO_FLAGS);
318 if (!std::isnan(d)) { 319 if (!std::isnan(d)) {
(...skipping 10 matching lines...) Expand all
329 } 330 }
330 return false; 331 return false;
331 } 332 }
332 333
333 334
334 void LookupIterator::InternalizeName() { 335 void LookupIterator::InternalizeName() {
335 if (name_->IsUniqueName()) return; 336 if (name_->IsUniqueName()) return;
336 name_ = factory()->InternalizeString(Handle<String>::cast(name_)); 337 name_ = factory()->InternalizeString(Handle<String>::cast(name_));
337 } 338 }
338 } } // namespace v8::internal 339 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/lookup.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698