Revision: 19072
Author: [email protected]
Date: Tue Feb 4 13:53:41 2014 UTC
Log: Cleanup: Unify CodeGenerator class across platforms
[email protected]
Review URL: https://codereview.chromium.org/134643026
http://code.google.com/p/v8/source/detail?r=19072
Modified:
/branches/bleeding_edge/src/arm/codegen-arm.h
/branches/bleeding_edge/src/arm/full-codegen-arm.cc
/branches/bleeding_edge/src/codegen.h
/branches/bleeding_edge/src/ia32/codegen-ia32.h
/branches/bleeding_edge/src/ia32/full-codegen-ia32.cc
/branches/bleeding_edge/src/ia32/ic-ia32.cc
/branches/bleeding_edge/src/ia32/macro-assembler-ia32.h
/branches/bleeding_edge/src/mips/codegen-mips.h
/branches/bleeding_edge/src/x64/codegen-x64.h
/branches/bleeding_edge/src/x64/full-codegen-x64.cc
=======================================
--- /branches/bleeding_edge/src/arm/codegen-arm.h Tue Jan 21 16:22:52 2014
UTC
+++ /branches/bleeding_edge/src/arm/codegen-arm.h Tue Feb 4 13:53:41 2014
UTC
@@ -34,50 +34,9 @@
namespace v8 {
namespace internal {
-// Forward declarations
-class CompilationInfo;
enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF };
-//
-------------------------------------------------------------------------
-// CodeGenerator
-
-class CodeGenerator: public AstVisitor {
- public:
- explicit CodeGenerator(Zone* zone) {
- InitializeAstVisitor(zone);
- }
-
- static bool MakeCode(CompilationInfo* info);
-
- // Printing of AST, etc. as requested by flags.
- static void MakeCodePrologue(CompilationInfo* info, const char* kind);
-
- // Allocate and install the code.
- static Handle<Code> MakeCodeEpilogue(MacroAssembler* masm,
- Code::Flags flags,
- CompilationInfo* info);
-
- // Print the code after compiling it.
- static void PrintCode(Handle<Code> code, CompilationInfo* info);
-
- static bool ShouldGenerateLog(Isolate* isolate, Expression* type);
-
- static void SetFunctionInfo(Handle<JSFunction> fun,
- FunctionLiteral* lit,
- bool is_toplevel,
- Handle<Script> script);
-
- static bool RecordPositions(MacroAssembler* masm,
- int pos,
- bool right_here = false);
-
- DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(CodeGenerator);
-};
-
class StringCharLoadGenerator : public AllStatic {
public:
=======================================
--- /branches/bleeding_edge/src/arm/full-codegen-arm.cc Fri Jan 31 16:52:17
2014 UTC
+++ /branches/bleeding_edge/src/arm/full-codegen-arm.cc Tue Feb 4 13:53:41
2014 UTC
@@ -3828,7 +3828,6 @@
Label done, not_found;
- // tmp now holds finger offset as a smi.
__ ldr(r2, FieldMemOperand(cache, JSFunctionResultCache::kFingerOffset));
// r2 now holds finger offset as a smi.
__ add(r3, cache, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
=======================================
--- /branches/bleeding_edge/src/codegen.h Fri Dec 20 13:33:20 2013 UTC
+++ /branches/bleeding_edge/src/codegen.h Tue Feb 4 13:53:41 2014 UTC
@@ -83,6 +83,34 @@
namespace v8 {
namespace internal {
+
+class CompilationInfo;
+
+
+class CodeGenerator {
+ public:
+ // Printing of AST, etc. as requested by flags.
+ static void MakeCodePrologue(CompilationInfo* info, const char* kind);
+
+ // Allocate and install the code.
+ static Handle<Code> MakeCodeEpilogue(MacroAssembler* masm,
+ Code::Flags flags,
+ CompilationInfo* info);
+
+ // Print the code after compiling it.
+ static void PrintCode(Handle<Code> code, CompilationInfo* info);
+
+ static bool ShouldGenerateLog(Isolate* isolate, Expression* type);
+
+ static bool RecordPositions(MacroAssembler* masm,
+ int pos,
+ bool right_here = false);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CodeGenerator);
+};
+
+
// Results of the library implementation of transcendental functions may
differ
// from the one we use in our generated code. Therefore we use the same
// generated code both in runtime and compiled code.
=======================================
--- /branches/bleeding_edge/src/ia32/codegen-ia32.h Tue Sep 3 06:57:16
2013 UTC
+++ /branches/bleeding_edge/src/ia32/codegen-ia32.h Tue Feb 4 13:53:41
2014 UTC
@@ -34,43 +34,6 @@
namespace v8 {
namespace internal {
-// Forward declarations
-class CompilationInfo;
-
-//
-------------------------------------------------------------------------
-// CodeGenerator
-
-class CodeGenerator {
- public:
- // Printing of AST, etc. as requested by flags.
- static void MakeCodePrologue(CompilationInfo* info, const char* kind);
-
- // Allocate and install the code.
- static Handle<Code> MakeCodeEpilogue(MacroAssembler* masm,
- Code::Flags flags,
- CompilationInfo* info);
-
- // Print the code after compiling it.
- static void PrintCode(Handle<Code> code, CompilationInfo* info);
-
- static bool ShouldGenerateLog(Isolate* isolate, Expression* type);
-
- static bool RecordPositions(MacroAssembler* masm,
- int pos,
- bool right_here = false);
-
-
- static Operand FixedArrayElementOperand(Register array,
- Register index_as_smi,
- int additional_offset = 0) {
- int offset = FixedArray::kHeaderSize + additional_offset *
kPointerSize;
- return FieldOperand(array, index_as_smi, times_half_pointer_size,
offset);
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(CodeGenerator);
-};
-
class StringCharLoadGenerator : public AllStatic {
public:
=======================================
--- /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Fri Jan 31
16:52:17 2014 UTC
+++ /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Tue Feb 4
13:53:41 2014 UTC
@@ -3793,13 +3793,13 @@
FieldOperand(cache, FixedArray::OffsetOfElementAt(cache_id)));
Label done, not_found;
- // tmp now holds finger offset as a smi.
STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize == 1);
__ mov(tmp, FieldOperand(cache, JSFunctionResultCache::kFingerOffset));
- __ cmp(key, CodeGenerator::FixedArrayElementOperand(cache, tmp));
+ // tmp now holds finger offset as a smi.
+ __ cmp(key, FixedArrayElementOperand(cache, tmp));
__ j(not_equal, ¬_found);
- __ mov(eax, CodeGenerator::FixedArrayElementOperand(cache, tmp, 1));
+ __ mov(eax, FixedArrayElementOperand(cache, tmp, 1));
__ jmp(&done);
__ bind(¬_found);
=======================================
--- /branches/bleeding_edge/src/ia32/ic-ia32.cc Fri Jan 31 16:52:17 2014 UTC
+++ /branches/bleeding_edge/src/ia32/ic-ia32.cc Tue Feb 4 13:53:41 2014 UTC
@@ -738,7 +738,7 @@
// We have to go to the runtime if the current value is the hole because
// there may be a callback on the element
Label holecheck_passed1;
- __ cmp(CodeGenerator::FixedArrayElementOperand(ebx, ecx),
+ __ cmp(FixedArrayElementOperand(ebx, ecx),
masm->isolate()->factory()->the_hole_value());
__ j(not_equal, &holecheck_passed1);
__ JumpIfDictionaryInPrototypeChain(edx, ebx, edi, slow);
@@ -755,7 +755,7 @@
Immediate(Smi::FromInt(1)));
}
// It's irrelevant whether array is smi-only or not when writing a smi.
- __ mov(CodeGenerator::FixedArrayElementOperand(ebx, ecx), eax);
+ __ mov(FixedArrayElementOperand(ebx, ecx), eax);
__ ret(0);
__ bind(&non_smi_value);
@@ -770,7 +770,7 @@
__ add(FieldOperand(edx, JSArray::kLengthOffset),
Immediate(Smi::FromInt(1)));
}
- __ mov(CodeGenerator::FixedArrayElementOperand(ebx, ecx), eax);
+ __ mov(FixedArrayElementOperand(ebx, ecx), eax);
// Update write barrier for the elements array address.
__ mov(edx, eax); // Preserve the value which is returned.
__ RecordWriteArray(
=======================================
--- /branches/bleeding_edge/src/ia32/macro-assembler-ia32.h Mon Jan 27
09:57:54 2014 UTC
+++ /branches/bleeding_edge/src/ia32/macro-assembler-ia32.h Tue Feb 4
13:53:41 2014 UTC
@@ -1080,6 +1080,14 @@
int offset) {
return Operand(object, index, scale, offset - kHeapObjectTag);
}
+
+
+inline Operand FixedArrayElementOperand(Register array,
+ Register index_as_smi,
+ int additional_offset = 0) {
+ int offset = FixedArray::kHeaderSize + additional_offset * kPointerSize;
+ return FieldOperand(array, index_as_smi, times_half_pointer_size,
offset);
+}
inline Operand ContextOperand(Register context, int index) {
=======================================
--- /branches/bleeding_edge/src/mips/codegen-mips.h Tue Jan 21 22:31:31
2014 UTC
+++ /branches/bleeding_edge/src/mips/codegen-mips.h Tue Feb 4 13:53:41
2014 UTC
@@ -36,50 +36,9 @@
namespace v8 {
namespace internal {
-// Forward declarations
-class CompilationInfo;
enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF };
-//
-------------------------------------------------------------------------
-// CodeGenerator
-
-class CodeGenerator: public AstVisitor {
- public:
- explicit CodeGenerator(Zone* zone) {
- InitializeAstVisitor(zone);
- }
-
- static bool MakeCode(CompilationInfo* info);
-
- // Printing of AST, etc. as requested by flags.
- static void MakeCodePrologue(CompilationInfo* info, const char* kind);
-
- // Allocate and install the code.
- static Handle<Code> MakeCodeEpilogue(MacroAssembler* masm,
- Code::Flags flags,
- CompilationInfo* info);
-
- // Print the code after compiling it.
- static void PrintCode(Handle<Code> code, CompilationInfo* info);
-
- static bool ShouldGenerateLog(Isolate* isolate, Expression* type);
-
- static void SetFunctionInfo(Handle<JSFunction> fun,
- FunctionLiteral* lit,
- bool is_toplevel,
- Handle<Script> script);
-
- static bool RecordPositions(MacroAssembler* masm,
- int pos,
- bool right_here = false);
-
- DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(CodeGenerator);
-};
-
class StringCharLoadGenerator : public AllStatic {
public:
=======================================
--- /branches/bleeding_edge/src/x64/codegen-x64.h Tue Jan 21 16:22:52 2014
UTC
+++ /branches/bleeding_edge/src/x64/codegen-x64.h Tue Feb 4 13:53:41 2014
UTC
@@ -34,45 +34,9 @@
namespace v8 {
namespace internal {
-// Forward declarations
-class CompilationInfo;
enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF };
-//
-------------------------------------------------------------------------
-// CodeGenerator
-
-class CodeGenerator: public AstVisitor {
- public:
- explicit CodeGenerator(Zone* zone) {
- InitializeAstVisitor(zone);
- }
-
- static bool MakeCode(CompilationInfo* info);
-
- // Printing of AST, etc. as requested by flags.
- static void MakeCodePrologue(CompilationInfo* info, const char* kind);
-
- // Allocate and install the code.
- static Handle<Code> MakeCodeEpilogue(MacroAssembler* masm,
- Code::Flags flags,
- CompilationInfo* info);
-
- // Print the code after compiling it.
- static void PrintCode(Handle<Code> code, CompilationInfo* info);
-
- static bool ShouldGenerateLog(Isolate* isolate, Expression* type);
-
- static bool RecordPositions(MacroAssembler* masm,
- int pos,
- bool right_here = false);
-
- DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(CodeGenerator);
-};
-
class StringCharLoadGenerator : public AllStatic {
public:
=======================================
--- /branches/bleeding_edge/src/x64/full-codegen-x64.cc Fri Jan 31 16:52:17
2014 UTC
+++ /branches/bleeding_edge/src/x64/full-codegen-x64.cc Tue Feb 4 13:53:41
2014 UTC
@@ -3765,9 +3765,9 @@
FieldOperand(cache, FixedArray::OffsetOfElementAt(cache_id)));
Label done, not_found;
- // tmp now holds finger offset as a smi.
STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize == 1);
__ movp(tmp, FieldOperand(cache, JSFunctionResultCache::kFingerOffset));
+ // tmp now holds finger offset as a smi.
SmiIndex index =
__ SmiToIndex(kScratchRegister, tmp, kPointerSizeLog2);
__ cmpq(key, FieldOperand(cache,
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.