| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 JumpTarget* false_target_; | 143 JumpTarget* false_target_; |
| 144 CodeGenState* previous_; | 144 CodeGenState* previous_; |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 | 147 |
| 148 // ------------------------------------------------------------------------- | 148 // ------------------------------------------------------------------------- |
| 149 // CodeGenerator | 149 // CodeGenerator |
| 150 | 150 |
| 151 class CodeGenerator: public AstVisitor { | 151 class CodeGenerator: public AstVisitor { |
| 152 public: | 152 public: |
| 153 // Compilation mode. Either the compiler is used as the primary |
| 154 // compiler and needs to setup everything or the compiler is used as |
| 155 // the secondary compiler for split compilation and has to handle |
| 156 // bailouts. |
| 157 enum Mode { |
| 158 PRIMARY, |
| 159 SECONDARY |
| 160 }; |
| 161 |
| 153 // Takes a function literal, generates code for it. This function should only | 162 // Takes a function literal, generates code for it. This function should only |
| 154 // be called by compiler.cc. | 163 // be called by compiler.cc. |
| 155 static Handle<Code> MakeCode(FunctionLiteral* fun, | 164 static Handle<Code> MakeCode(FunctionLiteral* fun, |
| 156 Handle<Script> script, | 165 Handle<Script> script, |
| 157 bool is_eval, | 166 bool is_eval, |
| 158 CompilationInfo* info); | 167 CompilationInfo* info); |
| 159 | 168 |
| 160 // Printing of AST, etc. as requested by flags. | 169 // Printing of AST, etc. as requested by flags. |
| 161 static void MakeCodePrologue(FunctionLiteral* fun); | 170 static void MakeCodePrologue(FunctionLiteral* fun); |
| 162 | 171 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 // reach the end of the statement (ie, it does not exit via break, | 242 // reach the end of the statement (ie, it does not exit via break, |
| 234 // continue, return, or throw). This function is used temporarily while | 243 // continue, return, or throw). This function is used temporarily while |
| 235 // the code generator is being transformed. | 244 // the code generator is being transformed. |
| 236 inline void VisitAndSpill(Statement* statement); | 245 inline void VisitAndSpill(Statement* statement); |
| 237 | 246 |
| 238 // Visit a list of statements and then spill the virtual frame if control | 247 // Visit a list of statements and then spill the virtual frame if control |
| 239 // flow can reach the end of the list. | 248 // flow can reach the end of the list. |
| 240 inline void VisitStatementsAndSpill(ZoneList<Statement*>* statements); | 249 inline void VisitStatementsAndSpill(ZoneList<Statement*>* statements); |
| 241 | 250 |
| 242 // Main code generation function | 251 // Main code generation function |
| 243 void GenCode(FunctionLiteral* fun, CompilationInfo* info); | 252 void Generate(FunctionLiteral* fun, Mode mode, CompilationInfo* info); |
| 244 | 253 |
| 245 // The following are used by class Reference. | 254 // The following are used by class Reference. |
| 246 void LoadReference(Reference* ref); | 255 void LoadReference(Reference* ref); |
| 247 void UnloadReference(Reference* ref); | 256 void UnloadReference(Reference* ref); |
| 248 | 257 |
| 249 static MemOperand ContextOperand(Register context, int index) { | 258 static MemOperand ContextOperand(Register context, int index) { |
| 250 return MemOperand(context, Context::SlotOffset(index)); | 259 return MemOperand(context, Context::SlotOffset(index)); |
| 251 } | 260 } |
| 252 | 261 |
| 253 MemOperand SlotOperand(Slot* slot, Register tmp); | 262 MemOperand SlotOperand(Slot* slot, Register tmp); |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 Major MajorKey() { return StringCompare; } | 556 Major MajorKey() { return StringCompare; } |
| 548 int MinorKey() { return 0; } | 557 int MinorKey() { return 0; } |
| 549 | 558 |
| 550 void Generate(MacroAssembler* masm); | 559 void Generate(MacroAssembler* masm); |
| 551 }; | 560 }; |
| 552 | 561 |
| 553 | 562 |
| 554 } } // namespace v8::internal | 563 } } // namespace v8::internal |
| 555 | 564 |
| 556 #endif // V8_ARM_CODEGEN_ARM_H_ | 565 #endif // V8_ARM_CODEGEN_ARM_H_ |
| OLD | NEW |