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

Side by Side Diff: src/codegen.cc

Issue 1800007: LiveEdit: breakpoints updates and fixes for related problems (Closed)
Patch Set: follow codereview Created 10 years, 8 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 | « no previous file | src/compiler.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 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 13 matching lines...) Expand all
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "bootstrapper.h" 30 #include "bootstrapper.h"
31 #include "codegen-inl.h" 31 #include "codegen-inl.h"
32 #include "compiler.h" 32 #include "compiler.h"
33 #include "debug.h" 33 #include "debug.h"
34 #include "liveedit.h"
35 #include "oprofile-agent.h" 34 #include "oprofile-agent.h"
36 #include "prettyprinter.h" 35 #include "prettyprinter.h"
37 #include "register-allocator-inl.h" 36 #include "register-allocator-inl.h"
38 #include "rewriter.h" 37 #include "rewriter.h"
39 #include "runtime.h" 38 #include "runtime.h"
40 #include "scopeinfo.h" 39 #include "scopeinfo.h"
41 #include "stub-cache.h" 40 #include "stub-cache.h"
42 #include "virtual-frame-inl.h" 41 #include "virtual-frame-inl.h"
43 42
44 namespace v8 { 43 namespace v8 {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 Counters::total_compiled_code_size.Increment(code->instruction_size()); 196 Counters::total_compiled_code_size.Increment(code->instruction_size());
198 } 197 }
199 return code; 198 return code;
200 } 199 }
201 200
202 201
203 // Generate the code. Takes a function literal, generates code for it, assemble 202 // Generate the code. Takes a function literal, generates code for it, assemble
204 // all the pieces into a Code object. This function is only to be called by 203 // all the pieces into a Code object. This function is only to be called by
205 // the compiler.cc code. 204 // the compiler.cc code.
206 Handle<Code> CodeGenerator::MakeCode(CompilationInfo* info) { 205 Handle<Code> CodeGenerator::MakeCode(CompilationInfo* info) {
207 LiveEditFunctionTracker live_edit_tracker(info->function());
208 Handle<Script> script = info->script(); 206 Handle<Script> script = info->script();
209 if (!script->IsUndefined() && !script->source()->IsUndefined()) { 207 if (!script->IsUndefined() && !script->source()->IsUndefined()) {
210 int len = String::cast(script->source())->length(); 208 int len = String::cast(script->source())->length();
211 Counters::total_old_codegen_source_size.Increment(len); 209 Counters::total_old_codegen_source_size.Increment(len);
212 } 210 }
213 MakeCodePrologue(info); 211 MakeCodePrologue(info);
214 // Generate code. 212 // Generate code.
215 const int kInitialBufferSize = 4 * KB; 213 const int kInitialBufferSize = 4 * KB;
216 MacroAssembler masm(NULL, kInitialBufferSize); 214 MacroAssembler masm(NULL, kInitialBufferSize);
217 CodeGenerator cgen(&masm); 215 CodeGenerator cgen(&masm);
218 CodeGeneratorScope scope(&cgen); 216 CodeGeneratorScope scope(&cgen);
219 live_edit_tracker.RecordFunctionScope(info->function()->scope());
220 cgen.Generate(info); 217 cgen.Generate(info);
221 if (cgen.HasStackOverflow()) { 218 if (cgen.HasStackOverflow()) {
222 ASSERT(!Top::has_pending_exception()); 219 ASSERT(!Top::has_pending_exception());
223 return Handle<Code>::null(); 220 return Handle<Code>::null();
224 } 221 }
225 222
226 InLoopFlag in_loop = (cgen.loop_nesting() != 0) ? IN_LOOP : NOT_IN_LOOP; 223 InLoopFlag in_loop = (cgen.loop_nesting() != 0) ? IN_LOOP : NOT_IN_LOOP;
227 Code::Flags flags = Code::ComputeFlags(Code::FUNCTION, in_loop); 224 Code::Flags flags = Code::ComputeFlags(Code::FUNCTION, in_loop);
228 Handle<Code> result = MakeCodeEpilogue(cgen.masm(), flags, info); 225 return MakeCodeEpilogue(cgen.masm(), flags, info);
229 live_edit_tracker.RecordFunctionCode(result);
230 return result;
231 } 226 }
232 227
233 228
234 #ifdef ENABLE_LOGGING_AND_PROFILING 229 #ifdef ENABLE_LOGGING_AND_PROFILING
235 230
236 bool CodeGenerator::ShouldGenerateLog(Expression* type) { 231 bool CodeGenerator::ShouldGenerateLog(Expression* type) {
237 ASSERT(type != NULL); 232 ASSERT(type != NULL);
238 if (!Logger::is_logging() && !CpuProfiler::is_profiling()) return false; 233 if (!Logger::is_logging() && !CpuProfiler::is_profiling()) return false;
239 Handle<String> name = Handle<String>::cast(type->AsLiteral()->handle()); 234 Handle<String> name = Handle<String>::cast(type->AsLiteral()->handle());
240 if (FLAG_log_regexp) { 235 if (FLAG_log_regexp) {
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 } 476 }
482 } 477 }
483 478
484 479
485 void ApiGetterEntryStub::SetCustomCache(Code* value) { 480 void ApiGetterEntryStub::SetCustomCache(Code* value) {
486 info()->set_load_stub_cache(value); 481 info()->set_load_stub_cache(value);
487 } 482 }
488 483
489 484
490 } } // namespace v8::internal 485 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698