OLD | NEW |
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_FULL_CODEGEN_FULL_CODEGEN_H_ | 5 #ifndef V8_FULL_CODEGEN_FULL_CODEGEN_H_ |
6 #define V8_FULL_CODEGEN_FULL_CODEGEN_H_ | 6 #define V8_FULL_CODEGEN_FULL_CODEGEN_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
10 #include "src/ast.h" | 10 #include "src/ast.h" |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 Handle<Cell> profiling_counter_; | 965 Handle<Cell> profiling_counter_; |
966 bool generate_debug_code_; | 966 bool generate_debug_code_; |
967 | 967 |
968 friend class NestedStatement; | 968 friend class NestedStatement; |
969 | 969 |
970 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 970 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
971 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); | 971 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); |
972 }; | 972 }; |
973 | 973 |
974 | 974 |
975 // A map from property names to getter/setter pairs allocated in the zone. | |
976 class AccessorTable: public TemplateHashMap<Literal, | |
977 ObjectLiteral::Accessors, | |
978 ZoneAllocationPolicy> { | |
979 public: | |
980 explicit AccessorTable(Zone* zone) : | |
981 TemplateHashMap<Literal, ObjectLiteral::Accessors, | |
982 ZoneAllocationPolicy>(Literal::Match, | |
983 ZoneAllocationPolicy(zone)), | |
984 zone_(zone) { } | |
985 | |
986 Iterator lookup(Literal* literal) { | |
987 Iterator it = find(literal, true, ZoneAllocationPolicy(zone_)); | |
988 if (it->second == NULL) it->second = new(zone_) ObjectLiteral::Accessors(); | |
989 return it; | |
990 } | |
991 | |
992 private: | |
993 Zone* zone_; | |
994 }; | |
995 | |
996 | |
997 class BackEdgeTable { | 975 class BackEdgeTable { |
998 public: | 976 public: |
999 BackEdgeTable(Code* code, DisallowHeapAllocation* required) { | 977 BackEdgeTable(Code* code, DisallowHeapAllocation* required) { |
1000 DCHECK(code->kind() == Code::FUNCTION); | 978 DCHECK(code->kind() == Code::FUNCTION); |
1001 instruction_start_ = code->instruction_start(); | 979 instruction_start_ = code->instruction_start(); |
1002 Address table_address = instruction_start_ + code->back_edge_table_offset(); | 980 Address table_address = instruction_start_ + code->back_edge_table_offset(); |
1003 length_ = Memory::uint32_at(table_address); | 981 length_ = Memory::uint32_at(table_address); |
1004 start_ = table_address + kTableLengthSize; | 982 start_ = table_address + kTableLengthSize; |
1005 } | 983 } |
1006 | 984 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 Address start_; | 1052 Address start_; |
1075 Address instruction_start_; | 1053 Address instruction_start_; |
1076 uint32_t length_; | 1054 uint32_t length_; |
1077 }; | 1055 }; |
1078 | 1056 |
1079 | 1057 |
1080 } // namespace internal | 1058 } // namespace internal |
1081 } // namespace v8 | 1059 } // namespace v8 |
1082 | 1060 |
1083 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_ | 1061 #endif // V8_FULL_CODEGEN_FULL_CODEGEN_H_ |
OLD | NEW |