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

Unified Diff: src/fast-codegen.h

Issue 553149: Implement simple fast-path code for functions containing this property stores and global variables. (Closed)
Patch Set: Incorporated codereview comments. Created 10 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/data-flow.cc ('k') | src/fast-codegen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/fast-codegen.h
diff --git a/src/fast-codegen.h b/src/fast-codegen.h
index f28a0ea810a0b6e76d79b1c428206f79f494266e..b40f6fb7f912036e975b70528fcdd39905eb110f 100644
--- a/src/fast-codegen.h
+++ b/src/fast-codegen.h
@@ -65,27 +65,54 @@ class FastCodeGenSyntaxChecker: public AstVisitor {
class FastCodeGenerator: public AstVisitor {
public:
- FastCodeGenerator(Handle<Script> script, bool is_eval)
- : masm_(NULL),
+ FastCodeGenerator(MacroAssembler* masm, Handle<Script> script, bool is_eval)
+ : masm_(masm),
script_(script),
is_eval_(is_eval),
function_(NULL),
info_(NULL) {
}
- static void MakeCode(FunctionLiteral* fun,
- Handle<Script> script,
- bool is_eval,
- CompilationInfo* info);
+ static Handle<Code> MakeCode(FunctionLiteral* fun,
+ Handle<Script> script,
+ bool is_eval,
+ CompilationInfo* info);
void Generate(FunctionLiteral* fun, CompilationInfo* info);
private:
+ MacroAssembler* masm() { return masm_; }
+ FunctionLiteral* function() { return function_; }
+ Label* bailout() { return &bailout_; }
+
+ bool has_receiver() { return !info_->receiver().is_null(); }
+ Handle<Object> receiver() { return info_->receiver(); }
+ bool has_this_properties() { return info_->has_this_properties(); }
+
// AST node visit functions.
#define DECLARE_VISIT(type) virtual void Visit##type(type* node);
AST_NODE_LIST(DECLARE_VISIT)
#undef DECLARE_VISIT
+ // Emit code to load the receiver from the stack into a given register.
+ void EmitLoadReceiver(Register reg);
+
+ // Emit code to check that the receiver has the same map as the
+ // compile-time receiver. Receiver is expected in {ia32-edx, x64-rdx,
+ // arm-r1}. Emit a branch to the (single) bailout label if check fails.
+ void EmitReceiverMapCheck();
+
+ // Emit code to load a global variable value into {is32-eax, x64-rax,
+ // arm-r0}. Register {ia32-edx, x64-rdx, arm-r1} is preserved if it is
+ // holding the receiver and {is32-ecx, x64-rcx, arm-r2} is always
+ // clobbered.
+ void EmitGlobalVariableLoad(Handle<String> name);
+
+ // Emit a store to an own property of this. The stored value is expected
+ // in {ia32-eax, x64-rax, arm-r0} and the receiver in {is32-edx, x64-rdx,
+ // arm-r1}. Both are preserve.
+ void EmitThisPropertyStore(Handle<String> name);
+
MacroAssembler* masm_;
Handle<Script> script_;
bool is_eval_;
@@ -93,6 +120,8 @@ class FastCodeGenerator: public AstVisitor {
FunctionLiteral* function_;
CompilationInfo* info_;
+ Label bailout_;
+
DISALLOW_COPY_AND_ASSIGN(FastCodeGenerator);
};
« 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