| 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_X87 | 5 #if V8_TARGET_ARCH_X87 |
| 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 3320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3331 // calling eval, not the anonymous closure containing the eval code. | 3331 // calling eval, not the anonymous closure containing the eval code. |
| 3332 // Fetch it from the context. | 3332 // Fetch it from the context. |
| 3333 PushOperand(ContextOperand(esi, Context::CLOSURE_INDEX)); | 3333 PushOperand(ContextOperand(esi, Context::CLOSURE_INDEX)); |
| 3334 } else { | 3334 } else { |
| 3335 DCHECK(closure_scope->is_function_scope()); | 3335 DCHECK(closure_scope->is_function_scope()); |
| 3336 PushOperand(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 3336 PushOperand(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 3337 } | 3337 } |
| 3338 } | 3338 } |
| 3339 | 3339 |
| 3340 | 3340 |
| 3341 // ---------------------------------------------------------------------------- | |
| 3342 // Non-local control flow support. | |
| 3343 | |
| 3344 void FullCodeGenerator::EnterFinallyBlock() { | |
| 3345 // Store pending message while executing finally block. | |
| 3346 ExternalReference pending_message_obj = | |
| 3347 ExternalReference::address_of_pending_message_obj(isolate()); | |
| 3348 __ mov(edx, Operand::StaticVariable(pending_message_obj)); | |
| 3349 PushOperand(edx); | |
| 3350 | |
| 3351 ClearPendingMessage(); | |
| 3352 } | |
| 3353 | |
| 3354 | |
| 3355 void FullCodeGenerator::ExitFinallyBlock() { | |
| 3356 DCHECK(!result_register().is(edx)); | |
| 3357 // Restore pending message from stack. | |
| 3358 PopOperand(edx); | |
| 3359 ExternalReference pending_message_obj = | |
| 3360 ExternalReference::address_of_pending_message_obj(isolate()); | |
| 3361 __ mov(Operand::StaticVariable(pending_message_obj), edx); | |
| 3362 } | |
| 3363 | |
| 3364 | |
| 3365 void FullCodeGenerator::ClearPendingMessage() { | |
| 3366 DCHECK(!result_register().is(edx)); | |
| 3367 ExternalReference pending_message_obj = | |
| 3368 ExternalReference::address_of_pending_message_obj(isolate()); | |
| 3369 __ mov(edx, Immediate(isolate()->factory()->the_hole_value())); | |
| 3370 __ mov(Operand::StaticVariable(pending_message_obj), edx); | |
| 3371 } | |
| 3372 | |
| 3373 | |
| 3374 void FullCodeGenerator::DeferredCommands::EmitCommands() { | |
| 3375 DCHECK(!result_register().is(edx)); | |
| 3376 __ Pop(result_register()); // Restore the accumulator. | |
| 3377 __ Pop(edx); // Get the token. | |
| 3378 for (DeferredCommand cmd : commands_) { | |
| 3379 Label skip; | |
| 3380 __ cmp(edx, Immediate(Smi::FromInt(cmd.token))); | |
| 3381 __ j(not_equal, &skip); | |
| 3382 switch (cmd.command) { | |
| 3383 case kReturn: | |
| 3384 codegen_->EmitUnwindAndReturn(); | |
| 3385 break; | |
| 3386 case kThrow: | |
| 3387 __ Push(result_register()); | |
| 3388 __ CallRuntime(Runtime::kReThrow); | |
| 3389 break; | |
| 3390 case kContinue: | |
| 3391 codegen_->EmitContinue(cmd.target); | |
| 3392 break; | |
| 3393 case kBreak: | |
| 3394 codegen_->EmitBreak(cmd.target); | |
| 3395 break; | |
| 3396 } | |
| 3397 __ bind(&skip); | |
| 3398 } | |
| 3399 } | |
| 3400 | |
| 3401 #undef __ | 3341 #undef __ |
| 3402 | 3342 |
| 3403 | 3343 |
| 3404 static const byte kJnsInstruction = 0x79; | 3344 static const byte kJnsInstruction = 0x79; |
| 3405 static const byte kJnsOffset = 0x11; | 3345 static const byte kJnsOffset = 0x11; |
| 3406 static const byte kNopByteOne = 0x66; | 3346 static const byte kNopByteOne = 0x66; |
| 3407 static const byte kNopByteTwo = 0x90; | 3347 static const byte kNopByteTwo = 0x90; |
| 3408 #ifdef DEBUG | 3348 #ifdef DEBUG |
| 3409 static const byte kCallInstruction = 0xe8; | 3349 static const byte kCallInstruction = 0xe8; |
| 3410 #endif | 3350 #endif |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3469 isolate->builtins()->OnStackReplacement()->entry(), | 3409 isolate->builtins()->OnStackReplacement()->entry(), |
| 3470 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3410 Assembler::target_address_at(call_target_address, unoptimized_code)); |
| 3471 return ON_STACK_REPLACEMENT; | 3411 return ON_STACK_REPLACEMENT; |
| 3472 } | 3412 } |
| 3473 | 3413 |
| 3474 | 3414 |
| 3475 } // namespace internal | 3415 } // namespace internal |
| 3476 } // namespace v8 | 3416 } // namespace v8 |
| 3477 | 3417 |
| 3478 #endif // V8_TARGET_ARCH_X87 | 3418 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |