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

Side by Side Diff: src/ia32/fast-codegen-ia32.cc

Issue 271102: Record statement positions for the debugger in the fast code generator. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | src/x64/codegen-x64.h » ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // The live registers are: 43 // The live registers are:
44 // o edi: the JS function object being called (ie, ourselves) 44 // o edi: the JS function object being called (ie, ourselves)
45 // o esi: our context 45 // o esi: our context
46 // o ebp: our caller's frame pointer 46 // o ebp: our caller's frame pointer
47 // o esp: stack pointer (pointing to return address) 47 // o esp: stack pointer (pointing to return address)
48 // 48 //
49 // The function builds a JS frame. Please see JavaScriptFrameConstants in 49 // The function builds a JS frame. Please see JavaScriptFrameConstants in
50 // frames-ia32.h for its layout. 50 // frames-ia32.h for its layout.
51 void FastCodeGenerator::Generate(FunctionLiteral* fun) { 51 void FastCodeGenerator::Generate(FunctionLiteral* fun) {
52 function_ = fun; 52 function_ = fun;
53 SetFunctionPosition(fun);
53 54
54 __ push(ebp); // Caller's frame pointer. 55 __ push(ebp); // Caller's frame pointer.
55 __ mov(ebp, esp); 56 __ mov(ebp, esp);
56 __ push(esi); // Callee's context. 57 __ push(esi); // Callee's context.
57 __ push(edi); // Callee's JS Function. 58 __ push(edi); // Callee's JS Function.
58 59
59 { Comment cmnt(masm_, "[ Allocate locals"); 60 { Comment cmnt(masm_, "[ Allocate locals");
60 int locals_count = fun->scope()->num_stack_slots(); 61 int locals_count = fun->scope()->num_stack_slots();
61 for (int i = 0; i < locals_count; i++) { 62 for (int i = 0; i < locals_count; i++) {
62 __ push(Immediate(Factory::undefined_value())); 63 __ push(Immediate(Factory::undefined_value()));
(...skipping 12 matching lines...) Expand all
75 } 76 }
76 77
77 { Comment cmnt(masm_, "[ Body"); 78 { Comment cmnt(masm_, "[ Body");
78 VisitStatements(fun->body()); 79 VisitStatements(fun->body());
79 } 80 }
80 81
81 { Comment cmnt(masm_, "[ return <undefined>;"); 82 { Comment cmnt(masm_, "[ return <undefined>;");
82 // Emit a 'return undefined' in case control fell off the end of the 83 // Emit a 'return undefined' in case control fell off the end of the
83 // body. 84 // body.
84 __ mov(eax, Factory::undefined_value()); 85 __ mov(eax, Factory::undefined_value());
86 SetReturnPosition(fun);
85 __ RecordJSReturn(); 87 __ RecordJSReturn();
86 // Do not use the leave instruction here because it is too short to 88 // Do not use the leave instruction here because it is too short to
87 // patch with the code required by the debugger. 89 // patch with the code required by the debugger.
88 __ mov(esp, ebp); 90 __ mov(esp, ebp);
89 __ pop(ebp); 91 __ pop(ebp);
90 __ ret((fun->scope()->num_parameters() + 1) * kPointerSize); 92 __ ret((fun->scope()->num_parameters() + 1) * kPointerSize);
91 } 93 }
92 } 94 }
93 95
94 96
95 void FastCodeGenerator::VisitExpressionStatement(ExpressionStatement* stmt) { 97 void FastCodeGenerator::VisitExpressionStatement(ExpressionStatement* stmt) {
96 Comment cmnt(masm_, "[ ExpressionStatement"); 98 Comment cmnt(masm_, "[ ExpressionStatement");
99 SetStatementPosition(stmt);
97 Visit(stmt->expression()); 100 Visit(stmt->expression());
98 __ pop(eax); 101 __ pop(eax);
99 } 102 }
100 103
101 104
102 void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) { 105 void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
103 Comment cmnt(masm_, "[ ReturnStatement"); 106 Comment cmnt(masm_, "[ ReturnStatement");
107 SetStatementPosition(stmt);
104 Visit(stmt->expression()); 108 Visit(stmt->expression());
105 __ pop(eax); 109 __ pop(eax);
106 __ RecordJSReturn(); 110 __ RecordJSReturn();
107 // Do not use the leave instruction here because it is too short to 111 // Do not use the leave instruction here because it is too short to
108 // patch with the code required by the debugger. 112 // patch with the code required by the debugger.
109 __ mov(esp, ebp); 113 __ mov(esp, ebp);
110 __ pop(ebp); 114 __ pop(ebp);
111 __ ret((function_->scope()->num_parameters() + 1) * kPointerSize); 115 __ ret((function_->scope()->num_parameters() + 1) * kPointerSize);
112 } 116 }
113 117
114 118
115 void FastCodeGenerator::VisitSlot(Slot* expr) { 119 void FastCodeGenerator::VisitSlot(Slot* expr) {
116 Comment cmnt(masm_, "[ Slot"); 120 Comment cmnt(masm_, "[ Slot");
117 __ push(Operand(ebp, SlotOffset(expr))); 121 __ push(Operand(ebp, SlotOffset(expr)));
118 } 122 }
119 123
120 124
121 void FastCodeGenerator::VisitLiteral(Literal* expr) { 125 void FastCodeGenerator::VisitLiteral(Literal* expr) {
122 Comment cmnt(masm_, "[ Literal"); 126 Comment cmnt(masm_, "[ Literal");
123 __ push(Immediate(expr->handle())); 127 __ push(Immediate(expr->handle()));
124 } 128 }
125 129
126 130
127 void FastCodeGenerator::VisitAssignment(Assignment* expr) { 131 void FastCodeGenerator::VisitAssignment(Assignment* expr) {
128 Comment cmnt(masm_, "[ Assignment"); 132 Comment cmnt(masm_, "[ Assignment");
129 ASSERT(expr->op() == Token::ASSIGN || expr->op() == Token::INIT_VAR); 133 ASSERT(expr->op() == Token::ASSIGN || expr->op() == Token::INIT_VAR);
130
131 Visit(expr->value()); 134 Visit(expr->value());
132 135
133 Variable* var = expr->target()->AsVariableProxy()->AsVariable(); 136 Variable* var = expr->target()->AsVariableProxy()->AsVariable();
134 ASSERT(var != NULL && var->slot() != NULL); 137 ASSERT(var != NULL && var->slot() != NULL);
135 __ mov(eax, Operand(esp, 0)); 138 __ mov(eax, Operand(esp, 0));
136 __ mov(Operand(ebp, SlotOffset(var->slot())), eax); 139 __ mov(Operand(ebp, SlotOffset(var->slot())), eax);
137 } 140 }
138 141
139 142
140 } } // namespace v8::internal 143 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | src/x64/codegen-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698