| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 6 | 6 |
| 7 #include "src/full-codegen/full-codegen.h" | 7 #include "src/full-codegen/full-codegen.h" |
| 8 #include "src/ast/compile-time-value.h" | 8 #include "src/ast/compile-time-value.h" |
| 9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 3328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3339 // calling eval, not the anonymous closure containing the eval code. | 3339 // calling eval, not the anonymous closure containing the eval code. |
| 3340 // Fetch it from the context. | 3340 // Fetch it from the context. |
| 3341 PushOperand(ContextOperand(esi, Context::CLOSURE_INDEX)); | 3341 PushOperand(ContextOperand(esi, Context::CLOSURE_INDEX)); |
| 3342 } else { | 3342 } else { |
| 3343 DCHECK(closure_scope->is_function_scope()); | 3343 DCHECK(closure_scope->is_function_scope()); |
| 3344 PushOperand(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 3344 PushOperand(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 3345 } | 3345 } |
| 3346 } | 3346 } |
| 3347 | 3347 |
| 3348 | 3348 |
| 3349 // ---------------------------------------------------------------------------- | |
| 3350 // Non-local control flow support. | |
| 3351 | |
| 3352 void FullCodeGenerator::EnterFinallyBlock() { | |
| 3353 // Store pending message while executing finally block. | |
| 3354 ExternalReference pending_message_obj = | |
| 3355 ExternalReference::address_of_pending_message_obj(isolate()); | |
| 3356 __ mov(edx, Operand::StaticVariable(pending_message_obj)); | |
| 3357 PushOperand(edx); | |
| 3358 | |
| 3359 ClearPendingMessage(); | |
| 3360 } | |
| 3361 | |
| 3362 | |
| 3363 void FullCodeGenerator::ExitFinallyBlock() { | |
| 3364 DCHECK(!result_register().is(edx)); | |
| 3365 // Restore pending message from stack. | |
| 3366 PopOperand(edx); | |
| 3367 ExternalReference pending_message_obj = | |
| 3368 ExternalReference::address_of_pending_message_obj(isolate()); | |
| 3369 __ mov(Operand::StaticVariable(pending_message_obj), edx); | |
| 3370 } | |
| 3371 | |
| 3372 | |
| 3373 void FullCodeGenerator::ClearPendingMessage() { | |
| 3374 DCHECK(!result_register().is(edx)); | |
| 3375 ExternalReference pending_message_obj = | |
| 3376 ExternalReference::address_of_pending_message_obj(isolate()); | |
| 3377 __ mov(edx, Immediate(isolate()->factory()->the_hole_value())); | |
| 3378 __ mov(Operand::StaticVariable(pending_message_obj), edx); | |
| 3379 } | |
| 3380 | |
| 3381 | |
| 3382 void FullCodeGenerator::DeferredCommands::EmitCommands() { | |
| 3383 DCHECK(!result_register().is(edx)); | |
| 3384 __ Pop(result_register()); // Restore the accumulator. | |
| 3385 __ Pop(edx); // Get the token. | |
| 3386 for (DeferredCommand cmd : commands_) { | |
| 3387 Label skip; | |
| 3388 __ cmp(edx, Immediate(Smi::FromInt(cmd.token))); | |
| 3389 __ j(not_equal, &skip); | |
| 3390 switch (cmd.command) { | |
| 3391 case kReturn: | |
| 3392 codegen_->EmitUnwindAndReturn(); | |
| 3393 break; | |
| 3394 case kThrow: | |
| 3395 __ Push(result_register()); | |
| 3396 __ CallRuntime(Runtime::kReThrow); | |
| 3397 break; | |
| 3398 case kContinue: | |
| 3399 codegen_->EmitContinue(cmd.target); | |
| 3400 break; | |
| 3401 case kBreak: | |
| 3402 codegen_->EmitBreak(cmd.target); | |
| 3403 break; | |
| 3404 } | |
| 3405 __ bind(&skip); | |
| 3406 } | |
| 3407 } | |
| 3408 | |
| 3409 #undef __ | 3349 #undef __ |
| 3410 | 3350 |
| 3411 | 3351 |
| 3412 static const byte kJnsInstruction = 0x79; | 3352 static const byte kJnsInstruction = 0x79; |
| 3413 static const byte kJnsOffset = 0x11; | 3353 static const byte kJnsOffset = 0x11; |
| 3414 static const byte kNopByteOne = 0x66; | 3354 static const byte kNopByteOne = 0x66; |
| 3415 static const byte kNopByteTwo = 0x90; | 3355 static const byte kNopByteTwo = 0x90; |
| 3416 #ifdef DEBUG | 3356 #ifdef DEBUG |
| 3417 static const byte kCallInstruction = 0xe8; | 3357 static const byte kCallInstruction = 0xe8; |
| 3418 #endif | 3358 #endif |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3477 isolate->builtins()->OnStackReplacement()->entry(), | 3417 isolate->builtins()->OnStackReplacement()->entry(), |
| 3478 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3418 Assembler::target_address_at(call_target_address, unoptimized_code)); |
| 3479 return ON_STACK_REPLACEMENT; | 3419 return ON_STACK_REPLACEMENT; |
| 3480 } | 3420 } |
| 3481 | 3421 |
| 3482 | 3422 |
| 3483 } // namespace internal | 3423 } // namespace internal |
| 3484 } // namespace v8 | 3424 } // namespace v8 |
| 3485 | 3425 |
| 3486 #endif // V8_TARGET_ARCH_IA32 | 3426 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |