| OLD | NEW | 
|    1 // Copyright 2012 the V8 project authors. All rights reserved. |    1 // Copyright 2012 the V8 project authors. All rights reserved. | 
|    2 // Redistribution and use in source and binary forms, with or without |    2 // Redistribution and use in source and binary forms, with or without | 
|    3 // modification, are permitted provided that the following conditions are |    3 // modification, are permitted provided that the following conditions are | 
|    4 // met: |    4 // met: | 
|    5 // |    5 // | 
|    6 //     * Redistributions of source code must retain the above copyright |    6 //     * Redistributions of source code must retain the above copyright | 
|    7 //       notice, this list of conditions and the following disclaimer. |    7 //       notice, this list of conditions and the following disclaimer. | 
|    8 //     * Redistributions in binary form must reproduce the above |    8 //     * Redistributions in binary form must reproduce the above | 
|    9 //       copyright notice, this list of conditions and the following |    9 //       copyright notice, this list of conditions and the following | 
|   10 //       disclaimer in the documentation and/or other materials provided |   10 //       disclaimer in the documentation and/or other materials provided | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   45  |   45  | 
|   46 // Forward declarations. |   46 // Forward declarations. | 
|   47 class JumpPatchSite; |   47 class JumpPatchSite; | 
|   48  |   48  | 
|   49 // AST node visitor which can tell whether a given statement will be breakable |   49 // AST node visitor which can tell whether a given statement will be breakable | 
|   50 // when the code is compiled by the full compiler in the debugger. This means |   50 // when the code is compiled by the full compiler in the debugger. This means | 
|   51 // that there will be an IC (load/store/call) in the code generated for the |   51 // that there will be an IC (load/store/call) in the code generated for the | 
|   52 // debugger to piggybag on. |   52 // debugger to piggybag on. | 
|   53 class BreakableStatementChecker: public AstVisitor { |   53 class BreakableStatementChecker: public AstVisitor { | 
|   54  public: |   54  public: | 
|   55   explicit BreakableStatementChecker(Isolate* isolate) : is_breakable_(false) { |   55   explicit BreakableStatementChecker(Zone* zone) : is_breakable_(false) { | 
|   56     InitializeAstVisitor(isolate); |   56     InitializeAstVisitor(zone); | 
|   57   } |   57   } | 
|   58  |   58  | 
|   59   void Check(Statement* stmt); |   59   void Check(Statement* stmt); | 
|   60   void Check(Expression* stmt); |   60   void Check(Expression* stmt); | 
|   61  |   61  | 
|   62   bool is_breakable() { return is_breakable_; } |   62   bool is_breakable() { return is_breakable_; } | 
|   63  |   63  | 
|   64  private: |   64  private: | 
|   65   // AST node visit functions. |   65   // AST node visit functions. | 
|   66 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); |   66 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
|   92         loop_depth_(0), |   92         loop_depth_(0), | 
|   93         globals_(NULL), |   93         globals_(NULL), | 
|   94         context_(NULL), |   94         context_(NULL), | 
|   95         bailout_entries_(info->HasDeoptimizationSupport() |   95         bailout_entries_(info->HasDeoptimizationSupport() | 
|   96                          ? info->function()->ast_node_count() : 0, |   96                          ? info->function()->ast_node_count() : 0, | 
|   97                          info->zone()), |   97                          info->zone()), | 
|   98         back_edges_(2, info->zone()), |   98         back_edges_(2, info->zone()), | 
|   99         type_feedback_cells_(info->HasDeoptimizationSupport() |   99         type_feedback_cells_(info->HasDeoptimizationSupport() | 
|  100                              ? info->function()->ast_node_count() : 0, |  100                              ? info->function()->ast_node_count() : 0, | 
|  101                              info->zone()), |  101                              info->zone()), | 
|  102         ic_total_count_(0), |  102         ic_total_count_(0) { | 
|  103         zone_(info->zone()) { |  | 
|  104     Initialize(); |  103     Initialize(); | 
|  105   } |  104   } | 
|  106  |  105  | 
|  107   void Initialize(); |  106   void Initialize(); | 
|  108  |  107  | 
|  109   static bool MakeCode(CompilationInfo* info); |  108   static bool MakeCode(CompilationInfo* info); | 
|  110  |  109  | 
|  111   // Encode state and pc-offset as a BitField<type, start, size>. |  110   // Encode state and pc-offset as a BitField<type, start, size>. | 
|  112   // Only use 30 bits because we encode the result as a smi. |  111   // Only use 30 bits because we encode the result as a smi. | 
|  113   class StateField : public BitField<State, 0, 1> { }; |  112   class StateField : public BitField<State, 0, 1> { }; | 
|  114   class PcField    : public BitField<unsigned, 1, 30-1> { }; |  113   class PcField    : public BitField<unsigned, 1, 30-1> { }; | 
|  115  |  114  | 
|  116   static const char* State2String(State state) { |  115   static const char* State2String(State state) { | 
|  117     switch (state) { |  116     switch (state) { | 
|  118       case NO_REGISTERS: return "NO_REGISTERS"; |  117       case NO_REGISTERS: return "NO_REGISTERS"; | 
|  119       case TOS_REG: return "TOS_REG"; |  118       case TOS_REG: return "TOS_REG"; | 
|  120     } |  119     } | 
|  121     UNREACHABLE(); |  120     UNREACHABLE(); | 
|  122     return NULL; |  121     return NULL; | 
|  123   } |  122   } | 
|  124  |  123  | 
|  125   Zone* zone() const { return zone_; } |  | 
|  126  |  | 
|  127   static const int kMaxBackEdgeWeight = 127; |  124   static const int kMaxBackEdgeWeight = 127; | 
|  128  |  125  | 
|  129   // Platform-specific code size multiplier. |  126   // Platform-specific code size multiplier. | 
|  130 #if V8_TARGET_ARCH_IA32 |  127 #if V8_TARGET_ARCH_IA32 | 
|  131   static const int kCodeSizeMultiplier = 100; |  128   static const int kCodeSizeMultiplier = 100; | 
|  132 #elif V8_TARGET_ARCH_X64 |  129 #elif V8_TARGET_ARCH_X64 | 
|  133   static const int kCodeSizeMultiplier = 162; |  130   static const int kCodeSizeMultiplier = 162; | 
|  134 #elif V8_TARGET_ARCH_ARM |  131 #elif V8_TARGET_ARCH_ARM | 
|  135   static const int kCodeSizeMultiplier = 142; |  132   static const int kCodeSizeMultiplier = 142; | 
|  136 #elif V8_TARGET_ARCH_MIPS |  133 #elif V8_TARGET_ARCH_MIPS | 
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  838   int module_index_; |  835   int module_index_; | 
|  839   const ExpressionContext* context_; |  836   const ExpressionContext* context_; | 
|  840   ZoneList<BailoutEntry> bailout_entries_; |  837   ZoneList<BailoutEntry> bailout_entries_; | 
|  841   GrowableBitVector prepared_bailout_ids_; |  838   GrowableBitVector prepared_bailout_ids_; | 
|  842   ZoneList<BackEdgeEntry> back_edges_; |  839   ZoneList<BackEdgeEntry> back_edges_; | 
|  843   ZoneList<TypeFeedbackCellEntry> type_feedback_cells_; |  840   ZoneList<TypeFeedbackCellEntry> type_feedback_cells_; | 
|  844   int ic_total_count_; |  841   int ic_total_count_; | 
|  845   Handle<FixedArray> handler_table_; |  842   Handle<FixedArray> handler_table_; | 
|  846   Handle<Cell> profiling_counter_; |  843   Handle<Cell> profiling_counter_; | 
|  847   bool generate_debug_code_; |  844   bool generate_debug_code_; | 
|  848   Zone* zone_; |  | 
|  849  |  845  | 
|  850   friend class NestedStatement; |  846   friend class NestedStatement; | 
|  851  |  847  | 
|  852   DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |  848   DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 
|  853   DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); |  849   DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); | 
|  854 }; |  850 }; | 
|  855  |  851  | 
|  856  |  852  | 
|  857 // A map from property names to getter/setter pairs allocated in the zone. |  853 // A map from property names to getter/setter pairs allocated in the zone. | 
|  858 class AccessorTable: public TemplateHashMap<Literal, |  854 class AccessorTable: public TemplateHashMap<Literal, | 
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  959  |  955  | 
|  960   Address start_; |  956   Address start_; | 
|  961   Address instruction_start_; |  957   Address instruction_start_; | 
|  962   uint32_t length_; |  958   uint32_t length_; | 
|  963 }; |  959 }; | 
|  964  |  960  | 
|  965  |  961  | 
|  966 } }  // namespace v8::internal |  962 } }  // namespace v8::internal | 
|  967  |  963  | 
|  968 #endif  // V8_FULL_CODEGEN_H_ |  964 #endif  // V8_FULL_CODEGEN_H_ | 
| OLD | NEW |