| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 29 matching lines...) Expand all Loading... |
| 40 // Forward declarations | 40 // Forward declarations |
| 41 class CompilationInfo; | 41 class CompilationInfo; |
| 42 | 42 |
| 43 enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF }; | 43 enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF }; |
| 44 | 44 |
| 45 // ------------------------------------------------------------------------- | 45 // ------------------------------------------------------------------------- |
| 46 // CodeGenerator | 46 // CodeGenerator |
| 47 | 47 |
| 48 class CodeGenerator: public AstVisitor { | 48 class CodeGenerator: public AstVisitor { |
| 49 public: | 49 public: |
| 50 CodeGenerator() { |
| 51 InitializeAstVisitor(); |
| 52 } |
| 53 |
| 50 static bool MakeCode(CompilationInfo* info); | 54 static bool MakeCode(CompilationInfo* info); |
| 51 | 55 |
| 52 // Printing of AST, etc. as requested by flags. | 56 // Printing of AST, etc. as requested by flags. |
| 53 static void MakeCodePrologue(CompilationInfo* info); | 57 static void MakeCodePrologue(CompilationInfo* info); |
| 54 | 58 |
| 55 // Allocate and install the code. | 59 // Allocate and install the code. |
| 56 static Handle<Code> MakeCodeEpilogue(MacroAssembler* masm, | 60 static Handle<Code> MakeCodeEpilogue(MacroAssembler* masm, |
| 57 Code::Flags flags, | 61 Code::Flags flags, |
| 58 CompilationInfo* info); | 62 CompilationInfo* info); |
| 59 | 63 |
| 60 // Print the code after compiling it. | 64 // Print the code after compiling it. |
| 61 static void PrintCode(Handle<Code> code, CompilationInfo* info); | 65 static void PrintCode(Handle<Code> code, CompilationInfo* info); |
| 62 | 66 |
| 63 static bool ShouldGenerateLog(Expression* type); | 67 static bool ShouldGenerateLog(Expression* type); |
| 64 | 68 |
| 65 static void SetFunctionInfo(Handle<JSFunction> fun, | 69 static void SetFunctionInfo(Handle<JSFunction> fun, |
| 66 FunctionLiteral* lit, | 70 FunctionLiteral* lit, |
| 67 bool is_toplevel, | 71 bool is_toplevel, |
| 68 Handle<Script> script); | 72 Handle<Script> script); |
| 69 | 73 |
| 70 static bool RecordPositions(MacroAssembler* masm, | 74 static bool RecordPositions(MacroAssembler* masm, |
| 71 int pos, | 75 int pos, |
| 72 bool right_here = false); | 76 bool right_here = false); |
| 73 | 77 |
| 78 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
| 79 |
| 74 private: | 80 private: |
| 75 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); | 81 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); |
| 76 }; | 82 }; |
| 77 | 83 |
| 78 | 84 |
| 79 class StringCharLoadGenerator : public AllStatic { | 85 class StringCharLoadGenerator : public AllStatic { |
| 80 public: | 86 public: |
| 81 // Generates the code for handling different string types and loading the | 87 // Generates the code for handling different string types and loading the |
| 82 // indexed character into |result|. We expect |index| as untagged input and | 88 // indexed character into |result|. We expect |index| as untagged input and |
| 83 // |result| as untagged output. | 89 // |result| as untagged output. |
| 84 static void Generate(MacroAssembler* masm, | 90 static void Generate(MacroAssembler* masm, |
| 85 Register string, | 91 Register string, |
| 86 Register index, | 92 Register index, |
| 87 Register result, | 93 Register result, |
| 88 Label* call_runtime); | 94 Label* call_runtime); |
| 89 | 95 |
| 90 private: | 96 private: |
| 91 DISALLOW_COPY_AND_ASSIGN(StringCharLoadGenerator); | 97 DISALLOW_COPY_AND_ASSIGN(StringCharLoadGenerator); |
| 92 }; | 98 }; |
| 93 | 99 |
| 94 | 100 |
| 95 class MathExpGenerator : public AllStatic { | 101 class MathExpGenerator : public AllStatic { |
| 96 public: | 102 public: |
| 97 static void EmitMathExp(MacroAssembler* masm, | 103 static void EmitMathExp(MacroAssembler* masm, |
| 98 DoubleRegister input, | 104 DwVfpRegister input, |
| 99 DoubleRegister result, | 105 DwVfpRegister result, |
| 100 DoubleRegister double_scratch1, | 106 DwVfpRegister double_scratch1, |
| 101 DoubleRegister double_scratch2, | 107 DwVfpRegister double_scratch2, |
| 102 Register temp1, | 108 Register temp1, |
| 103 Register temp2, | 109 Register temp2, |
| 104 Register temp3); | 110 Register temp3); |
| 105 | 111 |
| 106 private: | 112 private: |
| 107 DISALLOW_COPY_AND_ASSIGN(MathExpGenerator); | 113 DISALLOW_COPY_AND_ASSIGN(MathExpGenerator); |
| 108 }; | 114 }; |
| 109 | 115 |
| 110 } } // namespace v8::internal | 116 } } // namespace v8::internal |
| 111 | 117 |
| 112 #endif // V8_ARM_CODEGEN_ARM_H_ | 118 #endif // V8_ARM_CODEGEN_ARM_H_ |
| OLD | NEW |