| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 3234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3245 has_unlinks = has_unlinks || shadows[i]->is_linked(); | 3245 has_unlinks = has_unlinks || shadows[i]->is_linked(); |
| 3246 } | 3246 } |
| 3247 function_return_is_shadowed_ = function_return_was_shadowed; | 3247 function_return_is_shadowed_ = function_return_was_shadowed; |
| 3248 | 3248 |
| 3249 // Get an external reference to the handler address. | 3249 // Get an external reference to the handler address. |
| 3250 ExternalReference handler_address(Top::k_handler_address); | 3250 ExternalReference handler_address(Top::k_handler_address); |
| 3251 | 3251 |
| 3252 // Make sure that there's nothing left on the stack above the | 3252 // Make sure that there's nothing left on the stack above the |
| 3253 // handler structure. | 3253 // handler structure. |
| 3254 if (FLAG_debug_code) { | 3254 if (FLAG_debug_code) { |
| 3255 ASSERT(StackHandlerConstants::kAddressDisplacement == 0); | |
| 3256 __ mov(eax, Operand::StaticVariable(handler_address)); | 3255 __ mov(eax, Operand::StaticVariable(handler_address)); |
| 3257 __ cmp(esp, Operand(eax)); | 3256 __ cmp(esp, Operand(eax)); |
| 3258 __ Assert(equal, "stack pointer should point to top handler"); | 3257 __ Assert(equal, "stack pointer should point to top handler"); |
| 3259 } | 3258 } |
| 3260 | 3259 |
| 3261 // If we can fall off the end of the try block, unlink from try chain. | 3260 // If we can fall off the end of the try block, unlink from try chain. |
| 3262 if (has_valid_frame()) { | 3261 if (has_valid_frame()) { |
| 3263 // The next handler address is on top of the frame. Unlink from | 3262 // The next handler address is on top of the frame. Unlink from |
| 3264 // the handler list and drop the rest of this handler from the | 3263 // the handler list and drop the rest of this handler from the |
| 3265 // frame. | 3264 // frame. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3284 } else { | 3283 } else { |
| 3285 shadows[i]->Bind(); | 3284 shadows[i]->Bind(); |
| 3286 } | 3285 } |
| 3287 // Because we can be jumping here (to spilled code) from | 3286 // Because we can be jumping here (to spilled code) from |
| 3288 // unspilled code, we need to reestablish a spilled frame at | 3287 // unspilled code, we need to reestablish a spilled frame at |
| 3289 // this block. | 3288 // this block. |
| 3290 frame_->SpillAll(); | 3289 frame_->SpillAll(); |
| 3291 | 3290 |
| 3292 // Reload sp from the top handler, because some statements that we | 3291 // Reload sp from the top handler, because some statements that we |
| 3293 // break from (eg, for...in) may have left stuff on the stack. | 3292 // break from (eg, for...in) may have left stuff on the stack. |
| 3294 ASSERT(StackHandlerConstants::kAddressDisplacement == 0); | |
| 3295 __ mov(esp, Operand::StaticVariable(handler_address)); | 3293 __ mov(esp, Operand::StaticVariable(handler_address)); |
| 3296 frame_->Forget(frame_->height() - handler_height); | 3294 frame_->Forget(frame_->height() - handler_height); |
| 3297 | 3295 |
| 3298 ASSERT(StackHandlerConstants::kNextOffset == 0); | 3296 ASSERT(StackHandlerConstants::kNextOffset == 0); |
| 3299 frame_->EmitPop(Operand::StaticVariable(handler_address)); | 3297 frame_->EmitPop(Operand::StaticVariable(handler_address)); |
| 3300 frame_->Drop(StackHandlerConstants::kSize / kPointerSize - 1); | 3298 frame_->Drop(StackHandlerConstants::kSize / kPointerSize - 1); |
| 3301 | 3299 |
| 3302 if (i == kReturnShadowIndex) { | 3300 if (i == kReturnShadowIndex) { |
| 3303 if (!function_return_is_shadowed_) frame_->PrepareForReturn(); | 3301 if (!function_return_is_shadowed_) frame_->PrepareForReturn(); |
| 3304 shadows[i]->other_target()->Jump(&return_value); | 3302 shadows[i]->other_target()->Jump(&return_value); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3409 shadows[i]->Bind(); | 3407 shadows[i]->Bind(); |
| 3410 } | 3408 } |
| 3411 // Because we can be jumping here (to spilled code) from | 3409 // Because we can be jumping here (to spilled code) from |
| 3412 // unspilled code, we need to reestablish a spilled frame at | 3410 // unspilled code, we need to reestablish a spilled frame at |
| 3413 // this block. | 3411 // this block. |
| 3414 frame_->SpillAll(); | 3412 frame_->SpillAll(); |
| 3415 | 3413 |
| 3416 // Reload sp from the top handler, because some statements that | 3414 // Reload sp from the top handler, because some statements that |
| 3417 // we break from (eg, for...in) may have left stuff on the | 3415 // we break from (eg, for...in) may have left stuff on the |
| 3418 // stack. | 3416 // stack. |
| 3419 ASSERT(StackHandlerConstants::kAddressDisplacement == 0); | |
| 3420 __ mov(esp, Operand::StaticVariable(handler_address)); | 3417 __ mov(esp, Operand::StaticVariable(handler_address)); |
| 3421 frame_->Forget(frame_->height() - handler_height); | 3418 frame_->Forget(frame_->height() - handler_height); |
| 3422 | 3419 |
| 3423 // Unlink this handler and drop it from the frame. | 3420 // Unlink this handler and drop it from the frame. |
| 3424 ASSERT(StackHandlerConstants::kNextOffset == 0); | 3421 ASSERT(StackHandlerConstants::kNextOffset == 0); |
| 3425 frame_->EmitPop(Operand::StaticVariable(handler_address)); | 3422 frame_->EmitPop(Operand::StaticVariable(handler_address)); |
| 3426 frame_->Drop(StackHandlerConstants::kSize / kPointerSize - 1); | 3423 frame_->Drop(StackHandlerConstants::kSize / kPointerSize - 1); |
| 3427 | 3424 |
| 3428 if (i == kReturnShadowIndex) { | 3425 if (i == kReturnShadowIndex) { |
| 3429 // If this target shadowed the function return, materialize | 3426 // If this target shadowed the function return, materialize |
| (...skipping 3518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6948 __ Set(eax, Immediate(argc_)); | 6945 __ Set(eax, Immediate(argc_)); |
| 6949 __ Set(ebx, Immediate(0)); | 6946 __ Set(ebx, Immediate(0)); |
| 6950 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION); | 6947 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION); |
| 6951 Handle<Code> adaptor(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)); | 6948 Handle<Code> adaptor(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)); |
| 6952 __ jmp(adaptor, RelocInfo::CODE_TARGET); | 6949 __ jmp(adaptor, RelocInfo::CODE_TARGET); |
| 6953 } | 6950 } |
| 6954 | 6951 |
| 6955 | 6952 |
| 6956 | 6953 |
| 6957 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) { | 6954 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) { |
| 6955 // eax holds the exception. |
| 6956 |
| 6958 // Adjust this code if not the case. | 6957 // Adjust this code if not the case. |
| 6959 ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); | 6958 ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); |
| 6960 | 6959 |
| 6961 // Drop the sp to the top of the handler. | 6960 // Drop the sp to the top of the handler. |
| 6962 ASSERT(StackHandlerConstants::kAddressDisplacement == 0); | |
| 6963 ExternalReference handler_address(Top::k_handler_address); | 6961 ExternalReference handler_address(Top::k_handler_address); |
| 6964 __ mov(esp, Operand::StaticVariable(handler_address)); | 6962 __ mov(esp, Operand::StaticVariable(handler_address)); |
| 6965 | 6963 |
| 6966 // Restore next handler and frame pointer, discard handler state. | 6964 // Restore next handler and frame pointer, discard handler state. |
| 6967 ASSERT(StackHandlerConstants::kNextOffset == 0); | 6965 ASSERT(StackHandlerConstants::kNextOffset == 0); |
| 6968 __ pop(Operand::StaticVariable(handler_address)); | 6966 __ pop(Operand::StaticVariable(handler_address)); |
| 6969 ASSERT(StackHandlerConstants::kFPOffset == 1 * kPointerSize); | 6967 ASSERT(StackHandlerConstants::kFPOffset == 1 * kPointerSize); |
| 6970 __ pop(ebp); | 6968 __ pop(ebp); |
| 6971 __ pop(edx); // Remove state. | 6969 __ pop(edx); // Remove state. |
| 6972 | 6970 |
| 6973 // Before returning we restore the context from the frame pointer if not NULL. | 6971 // Before returning we restore the context from the frame pointer if |
| 6974 // The frame pointer is NULL in the exception handler of a JS entry frame. | 6972 // not NULL. The frame pointer is NULL in the exception handler of |
| 6975 __ xor_(esi, Operand(esi)); // tentatively set context pointer to NULL | 6973 // a JS entry frame. |
| 6974 __ xor_(esi, Operand(esi)); // Tentatively set context pointer to NULL. |
| 6976 Label skip; | 6975 Label skip; |
| 6977 __ cmp(ebp, 0); | 6976 __ cmp(ebp, 0); |
| 6978 __ j(equal, &skip, not_taken); | 6977 __ j(equal, &skip, not_taken); |
| 6979 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 6978 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 6980 __ bind(&skip); | 6979 __ bind(&skip); |
| 6981 | 6980 |
| 6982 ASSERT(StackHandlerConstants::kPCOffset == 3 * kPointerSize); | 6981 ASSERT(StackHandlerConstants::kPCOffset == 3 * kPointerSize); |
| 6983 __ ret(0); | 6982 __ ret(0); |
| 6984 } | 6983 } |
| 6985 | 6984 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7062 // Retry. | 7061 // Retry. |
| 7063 __ bind(&retry); | 7062 __ bind(&retry); |
| 7064 } | 7063 } |
| 7065 | 7064 |
| 7066 | 7065 |
| 7067 void CEntryStub::GenerateThrowOutOfMemory(MacroAssembler* masm) { | 7066 void CEntryStub::GenerateThrowOutOfMemory(MacroAssembler* masm) { |
| 7068 // Adjust this code if not the case. | 7067 // Adjust this code if not the case. |
| 7069 ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); | 7068 ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); |
| 7070 | 7069 |
| 7071 // Drop sp to the top stack handler. | 7070 // Drop sp to the top stack handler. |
| 7072 ASSERT(StackHandlerConstants::kAddressDisplacement == 0); | |
| 7073 ExternalReference handler_address(Top::k_handler_address); | 7071 ExternalReference handler_address(Top::k_handler_address); |
| 7074 __ mov(esp, Operand::StaticVariable(handler_address)); | 7072 __ mov(esp, Operand::StaticVariable(handler_address)); |
| 7075 | 7073 |
| 7076 // Unwind the handlers until the ENTRY handler is found. | 7074 // Unwind the handlers until the ENTRY handler is found. |
| 7077 Label loop, done; | 7075 Label loop, done; |
| 7078 __ bind(&loop); | 7076 __ bind(&loop); |
| 7079 // Load the type of the current stack handler. | 7077 // Load the type of the current stack handler. |
| 7080 const int kStateOffset = StackHandlerConstants::kStateOffset; | 7078 const int kStateOffset = StackHandlerConstants::kStateOffset; |
| 7081 __ cmp(Operand(esp, kStateOffset), Immediate(StackHandler::ENTRY)); | 7079 __ cmp(Operand(esp, kStateOffset), Immediate(StackHandler::ENTRY)); |
| 7082 __ j(equal, &done); | 7080 __ j(equal, &done); |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7334 | 7332 |
| 7335 // Slow-case: Go through the JavaScript implementation. | 7333 // Slow-case: Go through the JavaScript implementation. |
| 7336 __ bind(&slow); | 7334 __ bind(&slow); |
| 7337 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 7335 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
| 7338 } | 7336 } |
| 7339 | 7337 |
| 7340 | 7338 |
| 7341 #undef __ | 7339 #undef __ |
| 7342 | 7340 |
| 7343 } } // namespace v8::internal | 7341 } } // namespace v8::internal |
| OLD | NEW |