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

Side by Side Diff: src/lookup.cc

Issue 652303002: Correct semantics for numerically indexed stores to typed arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Disabled test, filed bug Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/lookup.h ('k') | src/objects.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 "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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 } 309 }
310 310
311 311
312 bool LookupIterator::IsSpecialNumericIndex() const {
313 if (GetStoreTarget()->IsJSTypedArray() && name()->IsString()) {
314 Handle<String> name_string = Handle<String>::cast(name());
315 if (name_string->length() > 0) {
316 double d =
317 StringToDouble(isolate()->unicode_cache(), *name_string, NO_FLAGS);
318 if (!std::isnan(d)) {
319 Factory* factory = isolate()->factory();
320 Handle<Object> num = factory->NewNumber(d);
321 Handle<String> roundtrip_string = factory->NumberToString(num);
322 if (String::Equals(name_string, roundtrip_string)) return true;
323 }
324 }
325 }
326 return false;
327 }
328
329
312 void LookupIterator::InternalizeName() { 330 void LookupIterator::InternalizeName() {
313 if (name_->IsUniqueName()) return; 331 if (name_->IsUniqueName()) return;
314 name_ = factory()->InternalizeString(Handle<String>::cast(name_)); 332 name_ = factory()->InternalizeString(Handle<String>::cast(name_));
315 } 333 }
316 } } // namespace v8::internal 334 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/lookup.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698