| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 // Return 1/0 for true/false in eax. | 252 // Return 1/0 for true/false in eax. |
| 253 __ bind(&true_result); | 253 __ bind(&true_result); |
| 254 __ mov(eax, 1); | 254 __ mov(eax, 1); |
| 255 __ ret(1 * kPointerSize); | 255 __ ret(1 * kPointerSize); |
| 256 __ bind(&false_result); | 256 __ bind(&false_result); |
| 257 __ mov(eax, 0); | 257 __ mov(eax, 0); |
| 258 __ ret(1 * kPointerSize); | 258 __ ret(1 * kPointerSize); |
| 259 } | 259 } |
| 260 | 260 |
| 261 | 261 |
| 262 void WriteBufferOverflowStub::Generate(MacroAssembler* masm) { |
| 263 // We don't allow a GC during a write buffer overflow so there is no need to |
| 264 // store the registers in any particular way, but we do have to store and |
| 265 // restore them. |
| 266 __ pushad(); |
| 267 if (save_doubles_ == kSaveFPRegs) { |
| 268 CpuFeatures::Scope scope(SSE2); |
| 269 __ sub(Operand(esp), Immediate(kDoubleSize * XMMRegister::kNumRegisters)); |
| 270 for (int i = 0; i < XMMRegister::kNumRegisters; i++) { |
| 271 XMMRegister reg = XMMRegister::from_code(i); |
| 272 __ movdbl(Operand(esp, i * kDoubleSize), reg); |
| 273 } |
| 274 } |
| 275 const int argument_count = 0; |
| 276 __ PrepareCallCFunction(argument_count, ecx); |
| 277 ExternalReference write_buffer_overflow = |
| 278 ExternalReference(Runtime::FunctionForId(Runtime::kWriteBufferOverflow)); |
| 279 __ CallCFunction(write_buffer_overflow, argument_count); |
| 280 if (save_doubles_ == kSaveFPRegs) { |
| 281 CpuFeatures::Scope scope(SSE2); |
| 282 for (int i = 0; i < XMMRegister::kNumRegisters; i++) { |
| 283 XMMRegister reg = XMMRegister::from_code(i); |
| 284 __ movdbl(reg, Operand(esp, i * kDoubleSize)); |
| 285 } |
| 286 __ add(Operand(esp), Immediate(kDoubleSize * XMMRegister::kNumRegisters)); |
| 287 } |
| 288 __ popad(); |
| 289 __ ret(0); |
| 290 } |
| 291 |
| 292 |
| 262 const char* GenericBinaryOpStub::GetName() { | 293 const char* GenericBinaryOpStub::GetName() { |
| 263 if (name_ != NULL) return name_; | 294 if (name_ != NULL) return name_; |
| 264 const int kMaxNameLength = 100; | 295 const int kMaxNameLength = 100; |
| 265 name_ = Bootstrapper::AllocateAutoDeletedArray(kMaxNameLength); | 296 name_ = Bootstrapper::AllocateAutoDeletedArray(kMaxNameLength); |
| 266 if (name_ == NULL) return "OOM"; | 297 if (name_ == NULL) return "OOM"; |
| 267 const char* op_name = Token::Name(op_); | 298 const char* op_name = Token::Name(op_); |
| 268 const char* overwrite_name; | 299 const char* overwrite_name; |
| 269 switch (mode_) { | 300 switch (mode_) { |
| 270 case NO_OVERWRITE: overwrite_name = "Alloc"; break; | 301 case NO_OVERWRITE: overwrite_name = "Alloc"; break; |
| 271 case OVERWRITE_RIGHT: overwrite_name = "OverwriteRight"; break; | 302 case OVERWRITE_RIGHT: overwrite_name = "OverwriteRight"; break; |
| (...skipping 3702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3974 | 4005 |
| 3975 // ebx: last_match_info backing store (FixedArray) | 4006 // ebx: last_match_info backing store (FixedArray) |
| 3976 // edx: number of capture registers | 4007 // edx: number of capture registers |
| 3977 // Store the capture count. | 4008 // Store the capture count. |
| 3978 __ SmiTag(edx); // Number of capture registers to smi. | 4009 __ SmiTag(edx); // Number of capture registers to smi. |
| 3979 __ mov(FieldOperand(ebx, RegExpImpl::kLastCaptureCountOffset), edx); | 4010 __ mov(FieldOperand(ebx, RegExpImpl::kLastCaptureCountOffset), edx); |
| 3980 __ SmiUntag(edx); // Number of capture registers back from smi. | 4011 __ SmiUntag(edx); // Number of capture registers back from smi. |
| 3981 // Store last subject and last input. | 4012 // Store last subject and last input. |
| 3982 __ mov(eax, Operand(esp, kSubjectOffset)); | 4013 __ mov(eax, Operand(esp, kSubjectOffset)); |
| 3983 __ mov(FieldOperand(ebx, RegExpImpl::kLastSubjectOffset), eax); | 4014 __ mov(FieldOperand(ebx, RegExpImpl::kLastSubjectOffset), eax); |
| 3984 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER | |
| 3985 __ mov(ecx, ebx); | 4015 __ mov(ecx, ebx); |
| 3986 __ RecordWrite(ecx, RegExpImpl::kLastSubjectOffset, eax, edi); | 4016 __ RecordWrite(ecx, |
| 3987 #endif | 4017 RegExpImpl::kLastSubjectOffset, |
| 4018 eax, |
| 4019 edi, |
| 4020 kDontSaveFPRegs); |
| 3988 __ mov(eax, Operand(esp, kSubjectOffset)); | 4021 __ mov(eax, Operand(esp, kSubjectOffset)); |
| 3989 __ mov(FieldOperand(ebx, RegExpImpl::kLastInputOffset), eax); | 4022 __ mov(FieldOperand(ebx, RegExpImpl::kLastInputOffset), eax); |
| 3990 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER | |
| 3991 __ mov(ecx, ebx); | 4023 __ mov(ecx, ebx); |
| 3992 __ RecordWrite(ecx, RegExpImpl::kLastInputOffset, eax, edi); | 4024 __ RecordWrite(ecx, RegExpImpl::kLastInputOffset, eax, edi, kDontSaveFPRegs); |
| 3993 #endif | |
| 3994 | 4025 |
| 3995 // Get the static offsets vector filled by the native regexp code. | 4026 // Get the static offsets vector filled by the native regexp code. |
| 3996 ExternalReference address_of_static_offsets_vector = | 4027 ExternalReference address_of_static_offsets_vector = |
| 3997 ExternalReference::address_of_static_offsets_vector(); | 4028 ExternalReference::address_of_static_offsets_vector(); |
| 3998 __ mov(ecx, Immediate(address_of_static_offsets_vector)); | 4029 __ mov(ecx, Immediate(address_of_static_offsets_vector)); |
| 3999 | 4030 |
| 4000 // ebx: last_match_info backing store (FixedArray) | 4031 // ebx: last_match_info backing store (FixedArray) |
| 4001 // ecx: offsets vector | 4032 // ecx: offsets vector |
| 4002 // edx: number of capture registers | 4033 // edx: number of capture registers |
| 4003 NearLabel next_capture, done; | 4034 NearLabel next_capture, done; |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4721 | 4752 |
| 4722 // Check for failure result. | 4753 // Check for failure result. |
| 4723 Label failure_returned; | 4754 Label failure_returned; |
| 4724 STATIC_ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); | 4755 STATIC_ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); |
| 4725 __ lea(ecx, Operand(eax, 1)); | 4756 __ lea(ecx, Operand(eax, 1)); |
| 4726 // Lower 2 bits of ecx are 0 iff eax has failure tag. | 4757 // Lower 2 bits of ecx are 0 iff eax has failure tag. |
| 4727 __ test(ecx, Immediate(kFailureTagMask)); | 4758 __ test(ecx, Immediate(kFailureTagMask)); |
| 4728 __ j(zero, &failure_returned, not_taken); | 4759 __ j(zero, &failure_returned, not_taken); |
| 4729 | 4760 |
| 4730 // Exit the JavaScript to C++ exit frame. | 4761 // Exit the JavaScript to C++ exit frame. |
| 4731 __ LeaveExitFrame(save_doubles_); | 4762 __ LeaveExitFrame(save_doubles_ == kSaveFPRegs); |
| 4732 __ ret(0); | 4763 __ ret(0); |
| 4733 | 4764 |
| 4734 // Handling of failure. | 4765 // Handling of failure. |
| 4735 __ bind(&failure_returned); | 4766 __ bind(&failure_returned); |
| 4736 | 4767 |
| 4737 Label retry; | 4768 Label retry; |
| 4738 // If the returned exception is RETRY_AFTER_GC continue at retry label | 4769 // If the returned exception is RETRY_AFTER_GC continue at retry label |
| 4739 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); | 4770 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); |
| 4740 __ test(eax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); | 4771 __ test(eax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); |
| 4741 __ j(zero, &retry, taken); | 4772 __ j(zero, &retry, taken); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4821 // ebp: frame pointer (restored after C call) | 4852 // ebp: frame pointer (restored after C call) |
| 4822 // esp: stack pointer (restored after C call) | 4853 // esp: stack pointer (restored after C call) |
| 4823 // esi: current context (C callee-saved) | 4854 // esi: current context (C callee-saved) |
| 4824 // edi: JS function of the caller (C callee-saved) | 4855 // edi: JS function of the caller (C callee-saved) |
| 4825 | 4856 |
| 4826 // NOTE: Invocations of builtins may return failure objects instead | 4857 // NOTE: Invocations of builtins may return failure objects instead |
| 4827 // of a proper result. The builtin entry handles this by performing | 4858 // of a proper result. The builtin entry handles this by performing |
| 4828 // a garbage collection and retrying the builtin (twice). | 4859 // a garbage collection and retrying the builtin (twice). |
| 4829 | 4860 |
| 4830 // Enter the exit frame that transitions from JavaScript to C++. | 4861 // Enter the exit frame that transitions from JavaScript to C++. |
| 4831 __ EnterExitFrame(save_doubles_); | 4862 __ EnterExitFrame(save_doubles_ == kSaveFPRegs); |
| 4832 | 4863 |
| 4833 // eax: result parameter for PerformGC, if any (setup below) | 4864 // eax: result parameter for PerformGC, if any (setup below) |
| 4834 // ebx: pointer to builtin function (C callee-saved) | 4865 // ebx: pointer to builtin function (C callee-saved) |
| 4835 // ebp: frame pointer (restored after C call) | 4866 // ebp: frame pointer (restored after C call) |
| 4836 // esp: stack pointer (restored after C call) | 4867 // esp: stack pointer (restored after C call) |
| 4837 // edi: number of arguments including receiver (C callee-saved) | 4868 // edi: number of arguments including receiver (C callee-saved) |
| 4838 // esi: argv pointer (C callee-saved) | 4869 // esi: argv pointer (C callee-saved) |
| 4839 | 4870 |
| 4840 Label throw_normal_exception; | 4871 Label throw_normal_exception; |
| 4841 Label throw_termination_exception; | 4872 Label throw_termination_exception; |
| (...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6409 // Do a tail call to the rewritten stub. | 6440 // Do a tail call to the rewritten stub. |
| 6410 __ jmp(Operand(edi)); | 6441 __ jmp(Operand(edi)); |
| 6411 } | 6442 } |
| 6412 | 6443 |
| 6413 | 6444 |
| 6414 #undef __ | 6445 #undef __ |
| 6415 | 6446 |
| 6416 } } // namespace v8::internal | 6447 } } // namespace v8::internal |
| 6417 | 6448 |
| 6418 #endif // V8_TARGET_ARCH_IA32 | 6449 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |