OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 25 matching lines...) Expand all Loading... | |
36 namespace v8 { | 36 namespace v8 { |
37 namespace internal { | 37 namespace internal { |
38 | 38 |
39 | 39 |
40 // When invoking builtins, we need to record the safepoint in the middle of | 40 // When invoking builtins, we need to record the safepoint in the middle of |
41 // the invoke instruction sequence generated by the macro assembler. | 41 // the invoke instruction sequence generated by the macro assembler. |
42 class SafepointGenerator : public PostCallGenerator { | 42 class SafepointGenerator : public PostCallGenerator { |
43 public: | 43 public: |
44 SafepointGenerator(LCodeGen* codegen, | 44 SafepointGenerator(LCodeGen* codegen, |
45 LPointerMap* pointers, | 45 LPointerMap* pointers, |
46 int deoptimization_index) | 46 int deoptimization_index, |
47 bool ensure_reloc_space = false) | |
47 : codegen_(codegen), | 48 : codegen_(codegen), |
48 pointers_(pointers), | 49 pointers_(pointers), |
49 deoptimization_index_(deoptimization_index) { } | 50 deoptimization_index_(deoptimization_index), |
51 ensure_reloc_space_(ensure_reloc_space) { } | |
50 virtual ~SafepointGenerator() { } | 52 virtual ~SafepointGenerator() { } |
51 | 53 |
52 virtual void Generate() { | 54 virtual void Generate() { |
55 // Ensure that we have enough space in the reloc info to patch | |
56 // this with calls when doing deoptimization. | |
57 if (ensure_reloc_space_) { | |
58 codegen_->masm()->RecordComment(NULL, true); | |
Kevin Millikin (Chromium)
2011/02/15 12:19:15
I guess printing comments works with NULL strings?
Rico
2011/02/15 13:33:00
Printing with null works, but I changed this to a
| |
59 } | |
53 codegen_->RecordSafepoint(pointers_, deoptimization_index_); | 60 codegen_->RecordSafepoint(pointers_, deoptimization_index_); |
54 } | 61 } |
55 | 62 |
56 private: | 63 private: |
57 LCodeGen* codegen_; | 64 LCodeGen* codegen_; |
58 LPointerMap* pointers_; | 65 LPointerMap* pointers_; |
59 int deoptimization_index_; | 66 int deoptimization_index_; |
67 bool ensure_reloc_space_; | |
60 }; | 68 }; |
61 | 69 |
62 | 70 |
63 #define __ masm()-> | 71 #define __ masm()-> |
64 | 72 |
65 bool LCodeGen::GenerateCode() { | 73 bool LCodeGen::GenerateCode() { |
66 HPhase phase("Code generation", chunk()); | 74 HPhase phase("Code generation", chunk()); |
67 ASSERT(is_unused()); | 75 ASSERT(is_unused()); |
68 status_ = GENERATING; | 76 status_ = GENERATING; |
69 CpuFeatures::Scope scope(SSE2); | 77 CpuFeatures::Scope scope(SSE2); |
(...skipping 3654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3724 if (key->IsConstantOperand()) { | 3732 if (key->IsConstantOperand()) { |
3725 __ push(ToImmediate(key)); | 3733 __ push(ToImmediate(key)); |
3726 } else { | 3734 } else { |
3727 __ push(ToOperand(key)); | 3735 __ push(ToOperand(key)); |
3728 } | 3736 } |
3729 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); | 3737 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); |
3730 LPointerMap* pointers = instr->pointer_map(); | 3738 LPointerMap* pointers = instr->pointer_map(); |
3731 LEnvironment* env = instr->deoptimization_environment(); | 3739 LEnvironment* env = instr->deoptimization_environment(); |
3732 RecordPosition(pointers->position()); | 3740 RecordPosition(pointers->position()); |
3733 RegisterEnvironmentForDeoptimization(env); | 3741 RegisterEnvironmentForDeoptimization(env); |
3742 // Create safepoint generator that will also ensure enough space in the | |
3743 // reloc info for patching in deoptimization (since this is invoking a | |
3744 // builtin) | |
3734 SafepointGenerator safepoint_generator(this, | 3745 SafepointGenerator safepoint_generator(this, |
3735 pointers, | 3746 pointers, |
3736 env->deoptimization_index()); | 3747 env->deoptimization_index(), |
3748 true); | |
3737 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 3749 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
3738 __ push(Immediate(Smi::FromInt(strict_mode_flag()))); | 3750 __ push(Immediate(Smi::FromInt(strict_mode_flag()))); |
3739 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, &safepoint_generator); | 3751 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, &safepoint_generator); |
3740 } | 3752 } |
3741 | 3753 |
3742 | 3754 |
3743 void LCodeGen::DoStackCheck(LStackCheck* instr) { | 3755 void LCodeGen::DoStackCheck(LStackCheck* instr) { |
3744 // Perform stack overflow check. | 3756 // Perform stack overflow check. |
3745 NearLabel done; | 3757 NearLabel done; |
3746 ExternalReference stack_limit = ExternalReference::address_of_stack_limit(); | 3758 ExternalReference stack_limit = ExternalReference::address_of_stack_limit(); |
(...skipping 21 matching lines...) Expand all Loading... | |
3768 ASSERT(osr_pc_offset_ == -1); | 3780 ASSERT(osr_pc_offset_ == -1); |
3769 osr_pc_offset_ = masm()->pc_offset(); | 3781 osr_pc_offset_ = masm()->pc_offset(); |
3770 } | 3782 } |
3771 | 3783 |
3772 | 3784 |
3773 #undef __ | 3785 #undef __ |
3774 | 3786 |
3775 } } // namespace v8::internal | 3787 } } // namespace v8::internal |
3776 | 3788 |
3777 #endif // V8_TARGET_ARCH_IA32 | 3789 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |