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

Unified Diff: src/lookup.cc

Issue 992913002: handle the special snowflakes that are Integer Indexed Exotic objects (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/lookup.h ('k') | src/lookup-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lookup.cc
diff --git a/src/lookup.cc b/src/lookup.cc
index b629f1980cac6c080c323766167295b46efe55f1..75212eb52cbe4b6d146d12c998fbf0bc232acbc5 100644
--- a/src/lookup.cc
+++ b/src/lookup.cc
@@ -121,8 +121,8 @@ void LookupIterator::PrepareTransitionToDataProperty(
Object::StoreFromKeyed store_mode) {
if (state_ == TRANSITION) return;
DCHECK(state_ != LookupIterator::ACCESSOR);
+ DCHECK(state_ != LookupIterator::INTEGER_INDEXED_EXOTIC);
Toon Verwaest 2015/03/10 12:01:25 DCHECK_NE
dcarney 2015/03/10 13:09:46 Done.
DCHECK(state_ == NOT_FOUND || !HolderIsReceiverOrHiddenPrototype());
- DCHECK(!IsSpecialNumericIndex());
// Can only be called when the receiver is a JSObject. JSProxy has to be
// handled via a trap. Adding properties to primitive values is not
// observable.
@@ -333,24 +333,34 @@ Handle<Object> LookupIterator::WriteDataValue(Handle<Object> value) {
}
-bool LookupIterator::IsSpecialNumericIndex() const {
- if (GetStoreTarget()->IsJSTypedArray() && name()->IsString()) {
- Handle<String> name_string = Handle<String>::cast(name());
- if (name_string->length() > 0) {
- double d =
- StringToDouble(isolate()->unicode_cache(), name_string, NO_FLAGS);
- if (!std::isnan(d)) {
- if (String::Equals(isolate()->factory()->minus_zero_string(),
- name_string))
- return true;
-
- Factory* factory = isolate()->factory();
- Handle<Object> num = factory->NewNumber(d);
- Handle<String> roundtrip_string = factory->NumberToString(num);
- if (String::Equals(name_string, roundtrip_string)) return true;
- }
+bool LookupIterator::IsIntegerIndexedExotic(JSReceiver* holder) {
+ DCHECK(exotic_index_state_ != ExoticIndexState::kNoIndex);
Toon Verwaest 2015/03/10 12:01:25 DCHECK_NE
dcarney 2015/03/10 13:09:46 dcheck not okay with this
+ if (!holder->IsJSTypedArray()) return false;
+ if (exotic_index_state_ == ExoticIndexState::kIndex) return true;
+ DCHECK(exotic_index_state_ == ExoticIndexState::kUninitialized);
Toon Verwaest 2015/03/10 12:01:25 DCHECK_EQ
dcarney 2015/03/10 13:09:46 same
+ if (!name()->IsString() || String::cast(*name())->length() == 0) {
+ exotic_index_state_ = ExoticIndexState::kNoIndex;
+ return false;
+ }
+ Handle<String> name_string = Handle<String>::cast(name());
+ double d = StringToDouble(isolate()->unicode_cache(), name_string, NO_FLAGS);
+ if (!std::isnan(d)) {
+ if (String::Equals(isolate()->factory()->minus_zero_string(),
+ name_string)) {
+ exotic_index_state_ = ExoticIndexState::kIndex;
+ return true;
+ }
+ // TODO(dcarney): this could be a lot faster.
+ AllowHeapAllocation allow;
Toon Verwaest 2015/03/10 12:01:25 Arg, reallowing allocation is crazy... that's goin
dcarney 2015/03/10 13:09:46 Done.
+ Factory* factory = isolate()->factory();
+ Handle<Object> num = factory->NewNumber(d);
+ Handle<String> roundtrip_string = factory->NumberToString(num);
+ if (String::Equals(name_string, roundtrip_string)) {
+ exotic_index_state_ = ExoticIndexState::kIndex;
+ return true;
}
}
+ exotic_index_state_ = ExoticIndexState::kNoIndex;
return false;
}
« no previous file with comments | « src/lookup.h ('k') | src/lookup-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698