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

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

Issue 2659603003: Adapt use-site to new BoilerplateDescription. (Closed)
Patch Set: One more use-site. Created 3 years, 10 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
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 #ifndef V8_AST_AST_H_ 5 #ifndef V8_AST_AST_H_
6 #define V8_AST_AST_H_ 6 #define V8_AST_AST_H_
7 7
8 #include "src/ast/ast-types.h" 8 #include "src/ast/ast-types.h"
9 #include "src/ast/ast-value-factory.h" 9 #include "src/ast/ast-value-factory.h"
10 #include "src/ast/modules.h" 10 #include "src/ast/modules.h"
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 Handle<Map> receiver_type_; 1377 Handle<Map> receiver_type_;
1378 }; 1378 };
1379 1379
1380 1380
1381 // An object literal has a boilerplate object that is used 1381 // An object literal has a boilerplate object that is used
1382 // for minimizing the work when constructing it at runtime. 1382 // for minimizing the work when constructing it at runtime.
1383 class ObjectLiteral final : public MaterializedLiteral { 1383 class ObjectLiteral final : public MaterializedLiteral {
1384 public: 1384 public:
1385 typedef ObjectLiteralProperty Property; 1385 typedef ObjectLiteralProperty Property;
1386 1386
1387 Handle<FixedArray> constant_properties() const { 1387 Handle<BoilerplateDescription> constant_properties() const {
1388 DCHECK(!constant_properties_.is_null()); 1388 DCHECK(!constant_properties_.is_null());
1389 return constant_properties_; 1389 return constant_properties_;
1390 } 1390 }
1391 int properties_count() const { return boilerplate_properties_; } 1391 int properties_count() const { return boilerplate_properties_; }
1392 ZoneList<Property*>* properties() const { return properties_; } 1392 ZoneList<Property*>* properties() const { return properties_; }
1393 bool fast_elements() const { return FastElementsField::decode(bit_field_); } 1393 bool fast_elements() const { return FastElementsField::decode(bit_field_); }
1394 bool may_store_doubles() const { 1394 bool may_store_doubles() const {
1395 return MayStoreDoublesField::decode(bit_field_); 1395 return MayStoreDoublesField::decode(bit_field_);
1396 } 1396 }
1397 bool has_elements() const { return HasElementsField::decode(bit_field_); } 1397 bool has_elements() const { return HasElementsField::decode(bit_field_); }
1398 bool has_shallow_properties() const { 1398 bool has_shallow_properties() const {
1399 return depth() == 1 && !has_elements() && !may_store_doubles(); 1399 return depth() == 1 && !has_elements() && !may_store_doubles();
1400 } 1400 }
1401 bool has_rest_property() const { 1401 bool has_rest_property() const {
1402 return HasRestPropertyField::decode(bit_field_); 1402 return HasRestPropertyField::decode(bit_field_);
1403 } 1403 }
1404 1404
1405 // Decide if a property should be in the object boilerplate. 1405 // Decide if a property should be in the object boilerplate.
1406 static bool IsBoilerplateProperty(Property* property); 1406 static bool IsBoilerplateProperty(Property* property);
1407 1407
1408 // Populate the depth field and flags. 1408 // Populate the depth field and flags.
1409 void InitDepthAndFlags(); 1409 void InitDepthAndFlags();
1410 1410
1411 // Get the constant properties fixed array, populating it if necessary. 1411 // Get the constant properties fixed array, populating it if necessary.
1412 Handle<FixedArray> GetOrBuildConstantProperties(Isolate* isolate) { 1412 Handle<BoilerplateDescription> GetOrBuildConstantProperties(
1413 Isolate* isolate) {
1413 if (constant_properties_.is_null()) { 1414 if (constant_properties_.is_null()) {
1414 BuildConstantProperties(isolate); 1415 BuildConstantProperties(isolate);
1415 } 1416 }
1416 return constant_properties(); 1417 return constant_properties();
1417 } 1418 }
1418 1419
1419 // Populate the constant properties fixed array. 1420 // Populate the constant properties fixed array.
1420 void BuildConstantProperties(Isolate* isolate); 1421 void BuildConstantProperties(Isolate* isolate);
1421 1422
1422 // Mark all computed expressions that are bound to a key that 1423 // Mark all computed expressions that are bound to a key that
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 bit_field_ |= FastElementsField::encode(false) | 1481 bit_field_ |= FastElementsField::encode(false) |
1481 HasElementsField::encode(false) | 1482 HasElementsField::encode(false) |
1482 MayStoreDoublesField::encode(false) | 1483 MayStoreDoublesField::encode(false) |
1483 HasRestPropertyField::encode(has_rest_property); 1484 HasRestPropertyField::encode(has_rest_property);
1484 } 1485 }
1485 1486
1486 static int parent_num_ids() { return MaterializedLiteral::num_ids(); } 1487 static int parent_num_ids() { return MaterializedLiteral::num_ids(); }
1487 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 1488 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
1488 1489
1489 uint32_t boilerplate_properties_; 1490 uint32_t boilerplate_properties_;
1490 Handle<FixedArray> constant_properties_; 1491 Handle<BoilerplateDescription> constant_properties_;
1491 ZoneList<Property*>* properties_; 1492 ZoneList<Property*>* properties_;
1492 1493
1493 class FastElementsField 1494 class FastElementsField
1494 : public BitField<bool, MaterializedLiteral::kNextBitFieldIndex, 1> {}; 1495 : public BitField<bool, MaterializedLiteral::kNextBitFieldIndex, 1> {};
1495 class HasElementsField : public BitField<bool, FastElementsField::kNext, 1> { 1496 class HasElementsField : public BitField<bool, FastElementsField::kNext, 1> {
1496 }; 1497 };
1497 class MayStoreDoublesField 1498 class MayStoreDoublesField
1498 : public BitField<bool, HasElementsField::kNext, 1> {}; 1499 : public BitField<bool, HasElementsField::kNext, 1> {};
1499 class HasRestPropertyField 1500 class HasRestPropertyField
1500 : public BitField<bool, MayStoreDoublesField::kNext, 1> {}; 1501 : public BitField<bool, MayStoreDoublesField::kNext, 1> {};
(...skipping 2145 matching lines...) Expand 10 before | Expand all | Expand 10 after
3646 : NULL; \ 3647 : NULL; \
3647 } 3648 }
3648 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) 3649 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS)
3649 #undef DECLARE_NODE_FUNCTIONS 3650 #undef DECLARE_NODE_FUNCTIONS
3650 3651
3651 3652
3652 } // namespace internal 3653 } // namespace internal
3653 } // namespace v8 3654 } // namespace v8
3654 3655
3655 #endif // V8_AST_AST_H_ 3656 #endif // V8_AST_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/compiler/bytecode-graph-builder.cc » ('j') | src/compiler/bytecode-graph-builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698