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

Side by Side Diff: src/ast.h

Issue 1372003002: Removing the Class/ObjectLiteral::LayoutFeedbackSlots(). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@vect
Patch Set: Fixed Created 5 years, 2 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
« no previous file with comments | « no previous file | src/ast.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_H_ 5 #ifndef V8_AST_H_
6 #define V8_AST_H_ 6 #define V8_AST_H_
7 7
8 #include "src/assembler.h" 8 #include "src/assembler.h"
9 #include "src/ast-value-factory.h" 9 #include "src/ast-value-factory.h"
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 1383
1384 bool IsCompileTimeValue(); 1384 bool IsCompileTimeValue();
1385 1385
1386 void set_emit_store(bool emit_store); 1386 void set_emit_store(bool emit_store);
1387 bool emit_store(); 1387 bool emit_store();
1388 1388
1389 bool is_static() const { return is_static_; } 1389 bool is_static() const { return is_static_; }
1390 bool is_computed_name() const { return is_computed_name_; } 1390 bool is_computed_name() const { return is_computed_name_; }
1391 1391
1392 FeedbackVectorICSlot GetSlot(int offset = 0) const { 1392 FeedbackVectorICSlot GetSlot(int offset = 0) const {
1393 if (ic_slot_or_count_ == FeedbackVectorICSlot::Invalid().ToInt()) { 1393 if (slot_.IsInvalid()) return slot_;
1394 return FeedbackVectorICSlot::Invalid(); 1394 int slot = slot_.ToInt();
1395 } 1395 return FeedbackVectorICSlot(slot + offset);
1396 return FeedbackVectorICSlot(ic_slot_or_count_ + offset);
1397 } 1396 }
1398 1397 FeedbackVectorICSlot slot() const { return slot_; }
1399 int ic_slot_count() const { 1398 void set_slot(FeedbackVectorICSlot slot) { slot_ = slot; }
1400 if (ic_slot_or_count_ == FeedbackVectorICSlot::Invalid().ToInt()) {
1401 return 0;
1402 }
1403 return ic_slot_or_count_;
1404 }
1405 1399
1406 void set_receiver_type(Handle<Map> map) { receiver_type_ = map; } 1400 void set_receiver_type(Handle<Map> map) { receiver_type_ = map; }
1407 void set_ic_slot_count(int count) {
1408 // Should only be called once.
1409 if (count == 0) {
1410 ic_slot_or_count_ = FeedbackVectorICSlot::Invalid().ToInt();
1411 } else {
1412 ic_slot_or_count_ = count;
1413 }
1414 }
1415
1416 int set_base_slot(int slot) {
1417 if (ic_slot_count() > 0) {
1418 int count = ic_slot_count();
1419 ic_slot_or_count_ = slot;
1420 return count;
1421 }
1422 return 0;
1423 }
1424 1401
1425 protected: 1402 protected:
1426 friend class AstNodeFactory; 1403 friend class AstNodeFactory;
1427 1404
1428 ObjectLiteralProperty(Expression* key, Expression* value, Kind kind, 1405 ObjectLiteralProperty(Expression* key, Expression* value, Kind kind,
1429 bool is_static, bool is_computed_name); 1406 bool is_static, bool is_computed_name);
1430 ObjectLiteralProperty(AstValueFactory* ast_value_factory, Expression* key, 1407 ObjectLiteralProperty(AstValueFactory* ast_value_factory, Expression* key,
1431 Expression* value, bool is_static, 1408 Expression* value, bool is_static,
1432 bool is_computed_name); 1409 bool is_computed_name);
1433 1410
1434 private: 1411 private:
1435 Expression* key_; 1412 Expression* key_;
1436 Expression* value_; 1413 Expression* value_;
1437 int ic_slot_or_count_; 1414 FeedbackVectorICSlot slot_;
1438 Kind kind_; 1415 Kind kind_;
1439 bool emit_store_; 1416 bool emit_store_;
1440 bool is_static_; 1417 bool is_static_;
1441 bool is_computed_name_; 1418 bool is_computed_name_;
1442 Handle<Map> receiver_type_; 1419 Handle<Map> receiver_type_;
1443 }; 1420 };
1444 1421
1445 1422
1446 // An object literal has a boilerplate object that is used 1423 // An object literal has a boilerplate object that is used
1447 // for minimizing the work when constructing it at runtime. 1424 // for minimizing the work when constructing it at runtime.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1510 1487
1511 // Unlike other AST nodes, this number of bailout IDs allocated for an 1488 // Unlike other AST nodes, this number of bailout IDs allocated for an
1512 // ObjectLiteral can vary, so num_ids() is not a static method. 1489 // ObjectLiteral can vary, so num_ids() is not a static method.
1513 int num_ids() const { return parent_num_ids() + 1 + properties()->length(); } 1490 int num_ids() const { return parent_num_ids() + 1 + properties()->length(); }
1514 1491
1515 // Object literals need one feedback slot for each non-trivial value, as well 1492 // Object literals need one feedback slot for each non-trivial value, as well
1516 // as some slots for home objects. 1493 // as some slots for home objects.
1517 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, 1494 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
1518 ICSlotCache* cache) override; 1495 ICSlotCache* cache) override;
1519 1496
1520 // After feedback slots were assigned, propagate information to the properties
1521 // which need it.
1522 void LayoutFeedbackSlots();
1523
1524 protected: 1497 protected:
1525 ObjectLiteral(Zone* zone, ZoneList<Property*>* properties, int literal_index, 1498 ObjectLiteral(Zone* zone, ZoneList<Property*>* properties, int literal_index,
1526 int boilerplate_properties, bool has_function, bool is_strong, 1499 int boilerplate_properties, bool has_function, bool is_strong,
1527 int pos) 1500 int pos)
1528 : MaterializedLiteral(zone, literal_index, is_strong, pos), 1501 : MaterializedLiteral(zone, literal_index, is_strong, pos),
1529 properties_(properties), 1502 properties_(properties),
1530 boilerplate_properties_(boilerplate_properties), 1503 boilerplate_properties_(boilerplate_properties),
1531 fast_elements_(false), 1504 fast_elements_(false),
1532 has_elements_(false), 1505 has_elements_(false),
1533 may_store_doubles_(false), 1506 may_store_doubles_(false),
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
2677 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, 2650 void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
2678 ICSlotCache* cache) override; 2651 ICSlotCache* cache) override;
2679 2652
2680 bool NeedsProxySlot() const { 2653 bool NeedsProxySlot() const {
2681 return FLAG_vector_stores && scope() != NULL && 2654 return FLAG_vector_stores && scope() != NULL &&
2682 class_variable_proxy()->var()->IsUnallocated(); 2655 class_variable_proxy()->var()->IsUnallocated();
2683 } 2656 }
2684 2657
2685 FeedbackVectorICSlot ProxySlot() const { return slot_; } 2658 FeedbackVectorICSlot ProxySlot() const { return slot_; }
2686 2659
2687 // After feedback slots were assigned, propagate information to the properties
2688 // which need it.
2689 void LayoutFeedbackSlots();
2690
2691 protected: 2660 protected:
2692 ClassLiteral(Zone* zone, const AstRawString* name, Scope* scope, 2661 ClassLiteral(Zone* zone, const AstRawString* name, Scope* scope,
2693 VariableProxy* class_variable_proxy, Expression* extends, 2662 VariableProxy* class_variable_proxy, Expression* extends,
2694 FunctionLiteral* constructor, ZoneList<Property*>* properties, 2663 FunctionLiteral* constructor, ZoneList<Property*>* properties,
2695 int start_position, int end_position) 2664 int start_position, int end_position)
2696 : Expression(zone, start_position), 2665 : Expression(zone, start_position),
2697 raw_name_(name), 2666 raw_name_(name),
2698 scope_(scope), 2667 scope_(scope),
2699 class_variable_proxy_(class_variable_proxy), 2668 class_variable_proxy_(class_variable_proxy),
2700 extends_(extends), 2669 extends_(extends),
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
3655 // ZoneObjects which need to persist until scope analysis must be allocated in 3624 // ZoneObjects which need to persist until scope analysis must be allocated in
3656 // the parser-level zone. 3625 // the parser-level zone.
3657 Zone* parser_zone_; 3626 Zone* parser_zone_;
3658 AstValueFactory* ast_value_factory_; 3627 AstValueFactory* ast_value_factory_;
3659 }; 3628 };
3660 3629
3661 3630
3662 } } // namespace v8::internal 3631 } } // namespace v8::internal
3663 3632
3664 #endif // V8_AST_H_ 3633 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698