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

Side by Side Diff: src/mips/full-codegen-mips.cc

Issue 9466012: Profiler experiments: Fix debugger in the presence of self-optimization headers (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/objects.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 private: 113 private:
114 MacroAssembler* masm_; 114 MacroAssembler* masm_;
115 Label patch_site_; 115 Label patch_site_;
116 #ifdef DEBUG 116 #ifdef DEBUG
117 bool info_emitted_; 117 bool info_emitted_;
118 #endif 118 #endif
119 }; 119 };
120 120
121 121
122 int FullCodeGenerator::self_optimization_header_size() {
123 return 0; // TODO(jkummerow): determine correct value.
124 }
125
126
122 // Generate code for a JS function. On entry to the function the receiver 127 // Generate code for a JS function. On entry to the function the receiver
123 // and arguments have been pushed on the stack left to right. The actual 128 // and arguments have been pushed on the stack left to right. The actual
124 // argument count matches the formal parameter count expected by the 129 // argument count matches the formal parameter count expected by the
125 // function. 130 // function.
126 // 131 //
127 // The live registers are: 132 // The live registers are:
128 // o a1: the JS function object being called (i.e. ourselves) 133 // o a1: the JS function object being called (i.e. ourselves)
129 // o cp: our context 134 // o cp: our context
130 // o fp: our caller's frame pointer 135 // o fp: our caller's frame pointer
131 // o sp: stack pointer 136 // o sp: stack pointer
132 // o ra: return address 137 // o ra: return address
133 // 138 //
134 // The function builds a JS frame. Please see JavaScriptFrameConstants in 139 // The function builds a JS frame. Please see JavaScriptFrameConstants in
135 // frames-mips.h for its layout. 140 // frames-mips.h for its layout.
136 void FullCodeGenerator::Generate() { 141 void FullCodeGenerator::Generate() {
137 CompilationInfo* info = info_; 142 CompilationInfo* info = info_;
138 handler_table_ = 143 handler_table_ =
139 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); 144 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED);
140 SetFunctionPosition(function()); 145 SetFunctionPosition(function());
141 Comment cmnt(masm_, "[ function compiled by full code generator"); 146 Comment cmnt(masm_, "[ function compiled by full code generator");
142 147
143 #ifdef DEBUG
144 if (strlen(FLAG_stop_at) > 0 &&
145 info->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) {
146 __ stop("stop-at");
147 }
148 #endif
149
150 // We can optionally optimize based on counters rather than statistical 148 // We can optionally optimize based on counters rather than statistical
151 // sampling. 149 // sampling.
152 if (info->ShouldSelfOptimize()) { 150 if (info->ShouldSelfOptimize()) {
153 if (FLAG_trace_opt_verbose) { 151 if (FLAG_trace_opt_verbose) {
154 PrintF("[adding self-optimization header to %s]\n", 152 PrintF("[adding self-optimization header to %s]\n",
155 *info->function()->debug_name()->ToCString()); 153 *info->function()->debug_name()->ToCString());
156 } 154 }
155 has_self_optimization_header_ = true;
157 MaybeObject* maybe_cell = isolate()->heap()->AllocateJSGlobalPropertyCell( 156 MaybeObject* maybe_cell = isolate()->heap()->AllocateJSGlobalPropertyCell(
158 Smi::FromInt(Compiler::kCallsUntilPrimitiveOpt)); 157 Smi::FromInt(Compiler::kCallsUntilPrimitiveOpt));
159 JSGlobalPropertyCell* cell; 158 JSGlobalPropertyCell* cell;
160 if (maybe_cell->To(&cell)) { 159 if (maybe_cell->To(&cell)) {
161 __ li(a2, Handle<JSGlobalPropertyCell>(cell)); 160 __ li(a2, Handle<JSGlobalPropertyCell>(cell));
162 __ lw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); 161 __ lw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
163 __ Subu(a3, a3, Operand(Smi::FromInt(1))); 162 __ Subu(a3, a3, Operand(Smi::FromInt(1)));
164 __ sw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); 163 __ sw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset));
165 Handle<Code> compile_stub( 164 Handle<Code> compile_stub(
166 isolate()->builtins()->builtin(Builtins::kLazyRecompile)); 165 isolate()->builtins()->builtin(Builtins::kLazyRecompile));
167 __ Jump(compile_stub, RelocInfo::CODE_TARGET, eq, a3, Operand(zero_reg)); 166 __ Jump(compile_stub, RelocInfo::CODE_TARGET, eq, a3, Operand(zero_reg));
167 ASSERT(masm_->pc_offset() == self_optimization_header_size());
168 } 168 }
169 } 169 }
170 170
171 #ifdef DEBUG
172 if (strlen(FLAG_stop_at) > 0 &&
173 info->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) {
174 __ stop("stop-at");
175 }
176 #endif
177
171 // Strict mode functions and builtins need to replace the receiver 178 // Strict mode functions and builtins need to replace the receiver
172 // with undefined when called as functions (without an explicit 179 // with undefined when called as functions (without an explicit
173 // receiver object). t1 is zero for method calls and non-zero for 180 // receiver object). t1 is zero for method calls and non-zero for
174 // function calls. 181 // function calls.
175 if (!info->is_classic_mode() || info->is_native()) { 182 if (!info->is_classic_mode() || info->is_native()) {
176 Label ok; 183 Label ok;
177 __ Branch(&ok, eq, t1, Operand(zero_reg)); 184 __ Branch(&ok, eq, t1, Operand(zero_reg));
178 int receiver_offset = info->scope()->num_parameters() * kPointerSize; 185 int receiver_offset = info->scope()->num_parameters() * kPointerSize;
179 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); 186 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
180 __ sw(a2, MemOperand(sp, receiver_offset)); 187 __ sw(a2, MemOperand(sp, receiver_offset));
(...skipping 4276 matching lines...) Expand 10 before | Expand all | Expand 10 after
4457 *context_length = 0; 4464 *context_length = 0;
4458 return previous_; 4465 return previous_;
4459 } 4466 }
4460 4467
4461 4468
4462 #undef __ 4469 #undef __
4463 4470
4464 } } // namespace v8::internal 4471 } } // namespace v8::internal
4465 4472
4466 #endif // V8_TARGET_ARCH_MIPS 4473 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698