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

Side by Side Diff: src/ast/ast.cc

Issue 2445333002: Ensure slow properties for simple {__proto__:null} literals. (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/ast/ast.h" 5 #include "src/ast/ast.h"
6 6
7 #include <cmath> // For isfinite. 7 #include <cmath> // For isfinite.
8 8
9 #include "src/ast/compile-time-value.h" 9 #include "src/ast/compile-time-value.h"
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 entry->value = property; 483 entry->value = property;
484 } 484 }
485 } 485 }
486 486
487 487
488 bool ObjectLiteral::IsBoilerplateProperty(ObjectLiteral::Property* property) { 488 bool ObjectLiteral::IsBoilerplateProperty(ObjectLiteral::Property* property) {
489 return property != NULL && 489 return property != NULL &&
490 property->kind() != ObjectLiteral::Property::PROTOTYPE; 490 property->kind() != ObjectLiteral::Property::PROTOTYPE;
491 } 491 }
492 492
493
494 void ObjectLiteral::BuildConstantProperties(Isolate* isolate) { 493 void ObjectLiteral::BuildConstantProperties(Isolate* isolate) {
495 if (!constant_properties_.is_null()) return; 494 if (!constant_properties_.is_null()) return;
496 495
497 // Allocate a fixed array to hold all the constant properties. 496 // Allocate a fixed array to hold all the constant properties.
498 Handle<FixedArray> constant_properties = isolate->factory()->NewFixedArray( 497 Handle<FixedArray> constant_properties = isolate->factory()->NewFixedArray(
499 boilerplate_properties_ * 2, TENURED); 498 boilerplate_properties_ * 2, TENURED);
500 499
501 int position = 0; 500 int position = 0;
502 // Accumulate the value in local variables and store it at the end. 501 // Accumulate the value in local variables and store it at the end.
503 bool is_simple = true; 502 bool is_simple = true;
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 // static 942 // static
944 bool Literal::Match(void* literal1, void* literal2) { 943 bool Literal::Match(void* literal1, void* literal2) {
945 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 944 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
946 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 945 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
947 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || 946 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) ||
948 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 947 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
949 } 948 }
950 949
951 } // namespace internal 950 } // namespace internal
952 } // namespace v8 951 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698