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

Unified Diff: src/runtime/runtime-literals.cc

Issue 1768203002: Properly prepare boilerplate properties in the parser for the runtime (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: drop IsInternalized DCHECK Created 4 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/ast/ast.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-literals.cc
diff --git a/src/runtime/runtime-literals.cc b/src/runtime/runtime-literals.cc
index cf7805e907719b1c0a45082edacd2728bccf89e5..3e1c710e3b8e72ac48f195275712498989991343 100644
--- a/src/runtime/runtime-literals.cc
+++ b/src/runtime/runtime-literals.cc
@@ -86,38 +86,17 @@ MUST_USE_RESULT static MaybeHandle<Object> CreateObjectLiteralBoilerplate(
}
MaybeHandle<Object> maybe_result;
uint32_t element_index = 0;
- if (key->IsInternalizedString()) {
- if (Handle<String>::cast(key)->AsArrayIndex(&element_index)) {
- // Array index as string (uint32).
- if (value->IsUninitialized()) value = handle(Smi::FromInt(0), isolate);
- maybe_result = JSObject::SetOwnElementIgnoreAttributes(
- boilerplate, element_index, value, NONE);
- } else {
- Handle<String> name(String::cast(*key));
- DCHECK(!name->AsArrayIndex(&element_index));
- maybe_result = JSObject::SetOwnPropertyIgnoreAttributes(
- boilerplate, name, value, NONE);
- }
- } else if (key->ToArrayIndex(&element_index)) {
+ if (key->ToArrayIndex(&element_index)) {
// Array index (uint32).
if (value->IsUninitialized()) value = handle(Smi::FromInt(0), isolate);
maybe_result = JSObject::SetOwnElementIgnoreAttributes(
boilerplate, element_index, value, NONE);
} else {
- // Non-uint32 number.
- DCHECK(key->IsNumber());
- double num = key->Number();
- char arr[100];
- Vector<char> buffer(arr, arraysize(arr));
- const char* str = DoubleToCString(num, buffer);
- Handle<String> name = isolate->factory()->NewStringFromAsciiChecked(str);
+ Handle<String> name = Handle<String>::cast(key);
+ DCHECK(!name->AsArrayIndex(&element_index));
maybe_result = JSObject::SetOwnPropertyIgnoreAttributes(boilerplate, name,
value, NONE);
}
- // If setting the property on the boilerplate throws an
- // exception, the exception is converted to an empty handle in
- // the handle based operations. In that case, we need to
- // convert back to an exception.
RETURN_ON_EXCEPTION(isolate, maybe_result, Object);
}
« no previous file with comments | « src/ast/ast.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698