Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Side by Side Diff: src/fast-codegen.h

Issue 594008: Initial implementation of fast path operation for bitwise OR. (Closed)
Patch Set: Fixed bug, added test. Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/data-flow.cc ('k') | src/fast-codegen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 CompilationInfo* info_; 59 CompilationInfo* info_;
60 bool has_supported_syntax_; 60 bool has_supported_syntax_;
61 61
62 DISALLOW_COPY_AND_ASSIGN(FastCodeGenSyntaxChecker); 62 DISALLOW_COPY_AND_ASSIGN(FastCodeGenSyntaxChecker);
63 }; 63 };
64 64
65 65
66 class FastCodeGenerator: public AstVisitor { 66 class FastCodeGenerator: public AstVisitor {
67 public: 67 public:
68 explicit FastCodeGenerator(MacroAssembler* masm) : masm_(masm), info_(NULL) {} 68 explicit FastCodeGenerator(MacroAssembler* masm)
69 : masm_(masm), info_(NULL), destination_(no_reg) {
70 }
69 71
70 static Handle<Code> MakeCode(CompilationInfo* info); 72 static Handle<Code> MakeCode(CompilationInfo* info);
71 73
72 void Generate(CompilationInfo* compilation_info); 74 void Generate(CompilationInfo* compilation_info);
73 75
74 private: 76 private:
75 MacroAssembler* masm() { return masm_; } 77 MacroAssembler* masm() { return masm_; }
76 CompilationInfo* info() { return info_; } 78 CompilationInfo* info() { return info_; }
77 Label* bailout() { return &bailout_; } 79 Label* bailout() { return &bailout_; }
78 80
81 Register destination() { return destination_; }
82 void set_destination(Register reg) { destination_ = reg; }
83
79 FunctionLiteral* function() { return info_->function(); } 84 FunctionLiteral* function() { return info_->function(); }
80 Scope* scope() { return info_->scope(); } 85 Scope* scope() { return info_->scope(); }
81 86
82 // Platform-specific fixed registers, all guaranteed distinct. 87 // Platform-specific fixed registers, all guaranteed distinct.
83 Register accumulator0(); 88 Register accumulator0();
84 Register accumulator1(); 89 Register accumulator1();
85 Register scratch0(); 90 Register scratch0();
86 Register scratch1(); 91 Register scratch1();
87 Register receiver_reg(); 92 Register receiver_reg();
88 Register context_reg(); 93 Register context_reg();
89 94
95 Register other_accumulator(Register reg) {
96 ASSERT(reg.is(accumulator0()) || reg.is(accumulator1()));
97 return (reg.is(accumulator0())) ? accumulator1() : accumulator0();
98 }
99
90 // AST node visit functions. 100 // AST node visit functions.
91 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); 101 #define DECLARE_VISIT(type) virtual void Visit##type(type* node);
92 AST_NODE_LIST(DECLARE_VISIT) 102 AST_NODE_LIST(DECLARE_VISIT)
93 #undef DECLARE_VISIT 103 #undef DECLARE_VISIT
94 104
95 // Emit code to load the receiver from the stack into the fixed receiver 105 // Emit code to load the receiver from the stack into receiver_reg.
96 // register.
97 void EmitLoadReceiver(); 106 void EmitLoadReceiver();
98 107
99 // Emit code to check that the receiver has the same map as the 108 // Emit code to load a global variable directly from a global property
100 // compile-time receiver. Receiver is expected in {ia32-edx, x64-rdx, 109 // cell into the destination register.
101 // arm-r1}. Emit a branch to the (single) bailout label if check fails.
102 void EmitReceiverMapCheck();
103
104 // Emit code to check that the global object has the same map as the
105 // global object seen at compile time.
106 void EmitGlobalMapCheck();
107
108 // Emit code to load a global variable directly from a global
109 // property cell into {ia32-eax, x64-rax, arm-r0}.
110 void EmitGlobalVariableLoad(Handle<Object> cell); 110 void EmitGlobalVariableLoad(Handle<Object> cell);
111 111
112 // Emit a store to an own property of this. The stored value is expected 112 // Emit a store to an own property of this. The stored value is expected
113 // in {ia32-eax, x64-rax, arm-r0} and the receiver in {is32-edx, x64-rdx, 113 // in accumulator0 and the receiver in receiver_reg. The receiver
114 // arm-r1}. Both are preserve. 114 // register is preserved and the result (the stored value) is left in the
115 // destination register.
115 void EmitThisPropertyStore(Handle<String> name); 116 void EmitThisPropertyStore(Handle<String> name);
116 117
118 // Emit a load from an own property of this. The receiver is expected in
119 // receiver_reg. The receiver register is preserved and the result is
120 // left in the destination register.
121 void EmitThisPropertyLoad(Handle<String> name);
122
123 // Emit a bitwise or operation. The left operand is in accumulator1 and
124 // the right is in accumulator0. The result should be left in the
125 // destination register.
126 void EmitBitOr();
127
117 MacroAssembler* masm_; 128 MacroAssembler* masm_;
118
119 CompilationInfo* info_; 129 CompilationInfo* info_;
120
121 Label bailout_; 130 Label bailout_;
131 Register destination_;
122 132
123 DISALLOW_COPY_AND_ASSIGN(FastCodeGenerator); 133 DISALLOW_COPY_AND_ASSIGN(FastCodeGenerator);
124 }; 134 };
125 135
126 136
127 } } // namespace v8::internal 137 } } // namespace v8::internal
128 138
129 #endif // V8_FAST_CODEGEN_H_ 139 #endif // V8_FAST_CODEGEN_H_
OLDNEW
« no previous file with comments | « src/data-flow.cc ('k') | src/fast-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698