OLD | NEW |
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 14 matching lines...) Expand all Loading... |
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 "codegen-inl.h" | 30 #include "codegen-inl.h" |
31 #include "compiler.h" | 31 #include "compiler.h" |
32 #include "full-codegen.h" | 32 #include "full-codegen.h" |
33 #include "stub-cache.h" | 33 #include "stub-cache.h" |
34 #include "debug.h" | 34 #include "debug.h" |
| 35 #include "liveedit.h" |
35 | 36 |
36 namespace v8 { | 37 namespace v8 { |
37 namespace internal { | 38 namespace internal { |
38 | 39 |
39 #define BAILOUT(reason) \ | 40 #define BAILOUT(reason) \ |
40 do { \ | 41 do { \ |
41 if (FLAG_trace_bailout) { \ | 42 if (FLAG_trace_bailout) { \ |
42 PrintF("%s\n", reason); \ | 43 PrintF("%s\n", reason); \ |
43 } \ | 44 } \ |
44 has_supported_syntax_ = false; \ | 45 has_supported_syntax_ = false; \ |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 | 442 |
442 Handle<Code> FullCodeGenerator::MakeCode(CompilationInfo* info) { | 443 Handle<Code> FullCodeGenerator::MakeCode(CompilationInfo* info) { |
443 Handle<Script> script = info->script(); | 444 Handle<Script> script = info->script(); |
444 if (!script->IsUndefined() && !script->source()->IsUndefined()) { | 445 if (!script->IsUndefined() && !script->source()->IsUndefined()) { |
445 int len = String::cast(script->source())->length(); | 446 int len = String::cast(script->source())->length(); |
446 Counters::total_full_codegen_source_size.Increment(len); | 447 Counters::total_full_codegen_source_size.Increment(len); |
447 } | 448 } |
448 CodeGenerator::MakeCodePrologue(info); | 449 CodeGenerator::MakeCodePrologue(info); |
449 const int kInitialBufferSize = 4 * KB; | 450 const int kInitialBufferSize = 4 * KB; |
450 MacroAssembler masm(NULL, kInitialBufferSize); | 451 MacroAssembler masm(NULL, kInitialBufferSize); |
| 452 LiveEditFunctionTracker live_edit_tracker(info->function()); |
| 453 |
451 FullCodeGenerator cgen(&masm); | 454 FullCodeGenerator cgen(&masm); |
452 cgen.Generate(info, PRIMARY); | 455 cgen.Generate(info, PRIMARY); |
453 if (cgen.HasStackOverflow()) { | 456 if (cgen.HasStackOverflow()) { |
454 ASSERT(!Top::has_pending_exception()); | 457 ASSERT(!Top::has_pending_exception()); |
455 return Handle<Code>::null(); | 458 return Handle<Code>::null(); |
456 } | 459 } |
457 Code::Flags flags = Code::ComputeFlags(Code::FUNCTION, NOT_IN_LOOP); | 460 Code::Flags flags = Code::ComputeFlags(Code::FUNCTION, NOT_IN_LOOP); |
458 return CodeGenerator::MakeCodeEpilogue(&masm, flags, info); | 461 Handle<Code> result = CodeGenerator::MakeCodeEpilogue(&masm, flags, info); |
| 462 live_edit_tracker.RecordFunctionCode(result); |
| 463 return result; |
459 } | 464 } |
460 | 465 |
461 | 466 |
462 int FullCodeGenerator::SlotOffset(Slot* slot) { | 467 int FullCodeGenerator::SlotOffset(Slot* slot) { |
463 ASSERT(slot != NULL); | 468 ASSERT(slot != NULL); |
464 // Offset is negative because higher indexes are at lower addresses. | 469 // Offset is negative because higher indexes are at lower addresses. |
465 int offset = -slot->index() * kPointerSize; | 470 int offset = -slot->index() * kPointerSize; |
466 // Adjust by a (parameter or local) base offset. | 471 // Adjust by a (parameter or local) base offset. |
467 switch (slot->type()) { | 472 switch (slot->type()) { |
468 case Slot::PARAMETER: | 473 case Slot::PARAMETER: |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 // The macros used here must preserve the result register. | 1155 // The macros used here must preserve the result register. |
1151 __ Drop(stack_depth); | 1156 __ Drop(stack_depth); |
1152 __ PopTryHandler(); | 1157 __ PopTryHandler(); |
1153 return 0; | 1158 return 0; |
1154 } | 1159 } |
1155 | 1160 |
1156 #undef __ | 1161 #undef __ |
1157 | 1162 |
1158 | 1163 |
1159 } } // namespace v8::internal | 1164 } } // namespace v8::internal |
OLD | NEW |