OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_S390 | 5 #if V8_TARGET_ARCH_S390 |
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 3345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3356 // context calling eval, not the anonymous closure containing the eval | 3356 // context calling eval, not the anonymous closure containing the eval |
3357 // code. Fetch it from the context. | 3357 // code. Fetch it from the context. |
3358 __ LoadP(ip, ContextMemOperand(cp, Context::CLOSURE_INDEX)); | 3358 __ LoadP(ip, ContextMemOperand(cp, Context::CLOSURE_INDEX)); |
3359 } else { | 3359 } else { |
3360 DCHECK(closure_scope->is_function_scope()); | 3360 DCHECK(closure_scope->is_function_scope()); |
3361 __ LoadP(ip, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 3361 __ LoadP(ip, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
3362 } | 3362 } |
3363 PushOperand(ip); | 3363 PushOperand(ip); |
3364 } | 3364 } |
3365 | 3365 |
3366 // ---------------------------------------------------------------------------- | |
3367 // Non-local control flow support. | |
3368 | |
3369 void FullCodeGenerator::EnterFinallyBlock() { | |
3370 DCHECK(!result_register().is(r3)); | |
3371 // Store pending message while executing finally block. | |
3372 ExternalReference pending_message_obj = | |
3373 ExternalReference::address_of_pending_message_obj(isolate()); | |
3374 __ mov(ip, Operand(pending_message_obj)); | |
3375 __ LoadP(r3, MemOperand(ip)); | |
3376 PushOperand(r3); | |
3377 | |
3378 ClearPendingMessage(); | |
3379 } | |
3380 | |
3381 void FullCodeGenerator::ExitFinallyBlock() { | |
3382 DCHECK(!result_register().is(r3)); | |
3383 // Restore pending message from stack. | |
3384 PopOperand(r3); | |
3385 ExternalReference pending_message_obj = | |
3386 ExternalReference::address_of_pending_message_obj(isolate()); | |
3387 __ mov(ip, Operand(pending_message_obj)); | |
3388 __ StoreP(r3, MemOperand(ip)); | |
3389 } | |
3390 | |
3391 void FullCodeGenerator::ClearPendingMessage() { | |
3392 DCHECK(!result_register().is(r3)); | |
3393 ExternalReference pending_message_obj = | |
3394 ExternalReference::address_of_pending_message_obj(isolate()); | |
3395 __ LoadRoot(r3, Heap::kTheHoleValueRootIndex); | |
3396 __ mov(ip, Operand(pending_message_obj)); | |
3397 __ StoreP(r3, MemOperand(ip)); | |
3398 } | |
3399 | |
3400 void FullCodeGenerator::DeferredCommands::EmitCommands() { | |
3401 DCHECK(!result_register().is(r3)); | |
3402 // Restore the accumulator (r2) and token (r3). | |
3403 __ Pop(r3, result_register()); | |
3404 for (DeferredCommand cmd : commands_) { | |
3405 Label skip; | |
3406 __ CmpSmiLiteral(r3, Smi::FromInt(cmd.token), r0); | |
3407 __ bne(&skip); | |
3408 switch (cmd.command) { | |
3409 case kReturn: | |
3410 codegen_->EmitUnwindAndReturn(); | |
3411 break; | |
3412 case kThrow: | |
3413 __ Push(result_register()); | |
3414 __ CallRuntime(Runtime::kReThrow); | |
3415 break; | |
3416 case kContinue: | |
3417 codegen_->EmitContinue(cmd.target); | |
3418 break; | |
3419 case kBreak: | |
3420 codegen_->EmitBreak(cmd.target); | |
3421 break; | |
3422 } | |
3423 __ bind(&skip); | |
3424 } | |
3425 } | |
3426 | |
3427 #undef __ | 3366 #undef __ |
3428 | 3367 |
3429 #if V8_TARGET_ARCH_S390X | 3368 #if V8_TARGET_ARCH_S390X |
3430 static const FourByteInstr kInterruptBranchInstruction = 0xA7A40011; | 3369 static const FourByteInstr kInterruptBranchInstruction = 0xA7A40011; |
3431 static const FourByteInstr kOSRBranchInstruction = 0xA7040011; | 3370 static const FourByteInstr kOSRBranchInstruction = 0xA7040011; |
3432 static const int16_t kBackEdgeBranchOffset = 0x11 * 2; | 3371 static const int16_t kBackEdgeBranchOffset = 0x11 * 2; |
3433 #else | 3372 #else |
3434 static const FourByteInstr kInterruptBranchInstruction = 0xA7A4000D; | 3373 static const FourByteInstr kInterruptBranchInstruction = 0xA7A4000D; |
3435 static const FourByteInstr kOSRBranchInstruction = 0xA704000D; | 3374 static const FourByteInstr kOSRBranchInstruction = 0xA704000D; |
3436 static const int16_t kBackEdgeBranchOffset = 0xD * 2; | 3375 static const int16_t kBackEdgeBranchOffset = 0xD * 2; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3498 DCHECK(kOSRBranchInstruction == br_instr); | 3437 DCHECK(kOSRBranchInstruction == br_instr); |
3499 | 3438 |
3500 DCHECK(interrupt_address == | 3439 DCHECK(interrupt_address == |
3501 isolate->builtins()->OnStackReplacement()->entry()); | 3440 isolate->builtins()->OnStackReplacement()->entry()); |
3502 return ON_STACK_REPLACEMENT; | 3441 return ON_STACK_REPLACEMENT; |
3503 } | 3442 } |
3504 | 3443 |
3505 } // namespace internal | 3444 } // namespace internal |
3506 } // namespace v8 | 3445 } // namespace v8 |
3507 #endif // V8_TARGET_ARCH_S390 | 3446 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |