Chromium Code Reviews| 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 248 if (current_instruction_ < instructions_->length() - 1) { | 248 if (current_instruction_ < instructions_->length() - 1) { |
| 249 return instructions_->at(current_instruction_ + 1); | 249 return instructions_->at(current_instruction_ + 1); |
| 250 } else { | 250 } else { |
| 251 return NULL; | 251 return NULL; |
| 252 } | 252 } |
| 253 } | 253 } |
| 254 | 254 |
| 255 | 255 |
| 256 bool LCodeGen::GenerateDeferredCode() { | 256 bool LCodeGen::GenerateDeferredCode() { |
| 257 ASSERT(is_generating()); | 257 ASSERT(is_generating()); |
| 258 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { | 258 Label last_jump; |
| 259 LDeferredCode* code = deferred_[i]; | 259 if (deferred_.length() > 0) { |
| 260 __ bind(code->entry()); | 260 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { |
| 261 code->Generate(); | 261 LDeferredCode* code = deferred_[i]; |
| 262 __ jmp(code->exit()); | 262 __ bind(code->entry()); |
| 263 code->Generate(); | |
| 264 #ifdef DEBUG | |
| 265 if (i == deferred_.length() - 1) { | |
| 266 __ bind(&last_jump); | |
| 267 } | |
| 268 #endif | |
| 269 __ jmp(code->exit()); | |
| 270 } | |
| 271 | |
| 272 // Reserve some space to ensure that the last piece of deferred code | |
| 273 // have room for lazy bailout. | |
|
sra1
2011/07/06 03:59:09
I don't understand why the last piece of deferred
| |
| 274 __ nop(); | |
| 275 __ nop(); | |
| 276 __ nop(); | |
| 277 | |
| 278 ASSERT(Deoptimizer::patch_size() <= | |
| 279 masm_->SizeOfCodeGeneratedSince(&last_jump)); | |
| 263 } | 280 } |
| 264 | 281 |
| 265 // Deferred code is the last part of the instruction sequence. Mark | 282 // Deferred code is the last part of the instruction sequence. Mark |
| 266 // the generated code as done unless we bailed out. | 283 // the generated code as done unless we bailed out. |
| 267 if (!is_aborted()) status_ = DONE; | 284 if (!is_aborted()) status_ = DONE; |
| 268 return !is_aborted(); | 285 return !is_aborted(); |
| 269 } | 286 } |
| 270 | 287 |
| 271 | 288 |
| 272 bool LCodeGen::GenerateSafepointTable() { | 289 bool LCodeGen::GenerateSafepointTable() { |
| (...skipping 3876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4149 // builtin) | 4166 // builtin) |
| 4150 SafepointGenerator safepoint_generator(this, | 4167 SafepointGenerator safepoint_generator(this, |
| 4151 pointers, | 4168 pointers, |
| 4152 env->deoptimization_index()); | 4169 env->deoptimization_index()); |
| 4153 __ push(Immediate(Smi::FromInt(strict_mode_flag()))); | 4170 __ push(Immediate(Smi::FromInt(strict_mode_flag()))); |
| 4154 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, safepoint_generator); | 4171 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, safepoint_generator); |
| 4155 } | 4172 } |
| 4156 | 4173 |
| 4157 | 4174 |
| 4158 void LCodeGen::DoDeferredStackCheck(LStackCheck* instr) { | 4175 void LCodeGen::DoDeferredStackCheck(LStackCheck* instr) { |
| 4159 PushSafepointRegistersScope scope(this); | 4176 { |
| 4160 CallRuntimeFromDeferred(Runtime::kStackGuard, 0, instr, instr->context()); | 4177 PushSafepointRegistersScope scope(this); |
| 4178 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | |
| 4179 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); | |
| 4180 RegisterLazyDeoptimization( | |
| 4181 instr, RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | |
| 4182 } | |
| 4183 | |
| 4184 // The gap code includes the restoring of the safepoint registers. | |
| 4185 int pc = masm()->pc_offset(); | |
| 4186 safepoints_.SetPcAfterGap(pc); | |
| 4161 } | 4187 } |
| 4162 | 4188 |
| 4163 | 4189 |
| 4164 void LCodeGen::DoStackCheck(LStackCheck* instr) { | 4190 void LCodeGen::DoStackCheck(LStackCheck* instr) { |
| 4165 class DeferredStackCheck: public LDeferredCode { | 4191 class DeferredStackCheck: public LDeferredCode { |
| 4166 public: | 4192 public: |
| 4167 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) | 4193 DeferredStackCheck(LCodeGen* codegen, LStackCheck* instr) |
| 4168 : LDeferredCode(codegen), instr_(instr) { } | 4194 : LDeferredCode(codegen), instr_(instr) { } |
| 4169 virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); } | 4195 virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); } |
| 4170 private: | 4196 private: |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4242 env->deoptimization_index()); | 4268 env->deoptimization_index()); |
| 4243 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4269 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
| 4244 } | 4270 } |
| 4245 | 4271 |
| 4246 | 4272 |
| 4247 #undef __ | 4273 #undef __ |
| 4248 | 4274 |
| 4249 } } // namespace v8::internal | 4275 } } // namespace v8::internal |
| 4250 | 4276 |
| 4251 #endif // V8_TARGET_ARCH_IA32 | 4277 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |