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

Unified Diff: src/ast/ast.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 | « no previous file | src/runtime/runtime-literals.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/ast.cc
diff --git a/src/ast/ast.cc b/src/ast/ast.cc
index 3b6e75c7d77da81b9a81708c26e7c71a77113037..43670ad8a5a2c87c134e41e84bc0384f0d417eb9 100644
--- a/src/ast/ast.cc
+++ b/src/ast/ast.cc
@@ -465,18 +465,15 @@ void ObjectLiteral::BuildConstantProperties(Isolate* isolate) {
// much larger than the number of elements, creating an object
// literal with fast elements will be a waste of space.
uint32_t element_index = 0;
- if (key->IsString()
- && Handle<String>::cast(key)->AsArrayIndex(&element_index)
- && element_index > max_element_index) {
- max_element_index = element_index;
+ if (key->IsString() && String::cast(*key)->AsArrayIndex(&element_index)) {
+ max_element_index = Max(element_index, max_element_index);
elements++;
- } else if (key->IsSmi()) {
- int key_value = Smi::cast(*key)->value();
- if (key_value > 0
- && static_cast<uint32_t>(key_value) > max_element_index) {
- max_element_index = key_value;
- }
+ key = isolate->factory()->NewNumberFromUint(element_index);
+ } else if (key->ToArrayIndex(&element_index)) {
+ max_element_index = Max(element_index, max_element_index);
elements++;
+ } else if (key->IsNumber()) {
+ key = isolate->factory()->NumberToString(key);
}
// Add name, value pair to the fixed array.
« no previous file with comments | « no previous file | src/runtime/runtime-literals.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698