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/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 __ bind(&no_arguments); | 1065 __ bind(&no_arguments); |
1066 { | 1066 { |
1067 __ Set(eax, 0); | 1067 __ Set(eax, 0); |
1068 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1068 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
1069 } | 1069 } |
1070 | 1070 |
1071 // 4c. The receiver is not callable, throw an appropriate TypeError. | 1071 // 4c. The receiver is not callable, throw an appropriate TypeError. |
1072 __ bind(&receiver_not_callable); | 1072 __ bind(&receiver_not_callable); |
1073 { | 1073 { |
1074 __ mov(Operand(esp, kPointerSize), edi); | 1074 __ mov(Operand(esp, kPointerSize), edi); |
1075 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1, 1); | 1075 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1); |
1076 } | 1076 } |
1077 } | 1077 } |
1078 | 1078 |
1079 | 1079 |
1080 // static | 1080 // static |
1081 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { | 1081 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { |
1082 // Stack Layout: | 1082 // Stack Layout: |
1083 // esp[0] : Return address | 1083 // esp[0] : Return address |
1084 // esp[8] : Argument n | 1084 // esp[8] : Argument n |
1085 // esp[16] : Argument n-1 | 1085 // esp[16] : Argument n-1 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 | 1174 |
1175 // 3a. Apply the target to the given argumentsList (passing undefined for | 1175 // 3a. Apply the target to the given argumentsList (passing undefined for |
1176 // new.target). | 1176 // new.target). |
1177 __ LoadRoot(edx, Heap::kUndefinedValueRootIndex); | 1177 __ LoadRoot(edx, Heap::kUndefinedValueRootIndex); |
1178 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); | 1178 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); |
1179 | 1179 |
1180 // 3b. The target is not callable, throw an appropriate TypeError. | 1180 // 3b. The target is not callable, throw an appropriate TypeError. |
1181 __ bind(&target_not_callable); | 1181 __ bind(&target_not_callable); |
1182 { | 1182 { |
1183 __ mov(Operand(esp, kPointerSize), edi); | 1183 __ mov(Operand(esp, kPointerSize), edi); |
1184 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1, 1); | 1184 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1); |
1185 } | 1185 } |
1186 } | 1186 } |
1187 | 1187 |
1188 | 1188 |
1189 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { | 1189 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { |
1190 // ----------- S t a t e ------------- | 1190 // ----------- S t a t e ------------- |
1191 // -- eax : argc | 1191 // -- eax : argc |
1192 // -- esp[0] : return address | 1192 // -- esp[0] : return address |
1193 // -- esp[4] : new.target (optional) | 1193 // -- esp[4] : new.target (optional) |
1194 // -- esp[8] : argumentsList | 1194 // -- esp[8] : argumentsList |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), 1 << Map::kIsConstructor); | 1244 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), 1 << Map::kIsConstructor); |
1245 __ j(zero, &new_target_not_constructor, Label::kNear); | 1245 __ j(zero, &new_target_not_constructor, Label::kNear); |
1246 | 1246 |
1247 // 4a. Construct the target with the given new.target and argumentsList. | 1247 // 4a. Construct the target with the given new.target and argumentsList. |
1248 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); | 1248 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); |
1249 | 1249 |
1250 // 4b. The target is not a constructor, throw an appropriate TypeError. | 1250 // 4b. The target is not a constructor, throw an appropriate TypeError. |
1251 __ bind(&target_not_constructor); | 1251 __ bind(&target_not_constructor); |
1252 { | 1252 { |
1253 __ mov(Operand(esp, kPointerSize), edi); | 1253 __ mov(Operand(esp, kPointerSize), edi); |
1254 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1, 1); | 1254 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1); |
1255 } | 1255 } |
1256 | 1256 |
1257 // 4c. The new.target is not a constructor, throw an appropriate TypeError. | 1257 // 4c. The new.target is not a constructor, throw an appropriate TypeError. |
1258 __ bind(&new_target_not_constructor); | 1258 __ bind(&new_target_not_constructor); |
1259 { | 1259 { |
1260 __ mov(Operand(esp, kPointerSize), edx); | 1260 __ mov(Operand(esp, kPointerSize), edx); |
1261 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1, 1); | 1261 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1); |
1262 } | 1262 } |
1263 } | 1263 } |
1264 | 1264 |
1265 | 1265 |
1266 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { | 1266 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { |
1267 // ----------- S t a t e ------------- | 1267 // ----------- S t a t e ------------- |
1268 // -- eax : argc | 1268 // -- eax : argc |
1269 // -- esp[0] : return address | 1269 // -- esp[0] : return address |
1270 // -- esp[4] : last argument | 1270 // -- esp[4] : last argument |
1271 // ----------------------------------- | 1271 // ----------------------------------- |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1370 ToStringStub stub(masm->isolate()); | 1370 ToStringStub stub(masm->isolate()); |
1371 __ TailCallStub(&stub); | 1371 __ TailCallStub(&stub); |
1372 } | 1372 } |
1373 | 1373 |
1374 // 3b. Convert symbol in eax to a string. | 1374 // 3b. Convert symbol in eax to a string. |
1375 __ bind(&symbol_descriptive_string); | 1375 __ bind(&symbol_descriptive_string); |
1376 { | 1376 { |
1377 __ PopReturnAddressTo(ecx); | 1377 __ PopReturnAddressTo(ecx); |
1378 __ Push(eax); | 1378 __ Push(eax); |
1379 __ PushReturnAddressFrom(ecx); | 1379 __ PushReturnAddressFrom(ecx); |
1380 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1, 1); | 1380 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1); |
1381 } | 1381 } |
1382 } | 1382 } |
1383 | 1383 |
1384 | 1384 |
1385 // static | 1385 // static |
1386 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { | 1386 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { |
1387 // ----------- S t a t e ------------- | 1387 // ----------- S t a t e ------------- |
1388 // -- eax : number of arguments | 1388 // -- eax : number of arguments |
1389 // -- edi : constructor function | 1389 // -- edi : constructor function |
1390 // -- edx : new target | 1390 // -- edx : new target |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 ExternalReference::address_of_real_stack_limit(masm->isolate()); | 1616 ExternalReference::address_of_real_stack_limit(masm->isolate()); |
1617 __ mov(ecx, Operand::StaticVariable(real_stack_limit)); | 1617 __ mov(ecx, Operand::StaticVariable(real_stack_limit)); |
1618 // Make ecx the space we have left. The stack might already be overflowed | 1618 // Make ecx the space we have left. The stack might already be overflowed |
1619 // here which will cause ecx to become negative. | 1619 // here which will cause ecx to become negative. |
1620 __ neg(ecx); | 1620 __ neg(ecx); |
1621 __ add(ecx, esp); | 1621 __ add(ecx, esp); |
1622 __ sar(ecx, kPointerSizeLog2); | 1622 __ sar(ecx, kPointerSizeLog2); |
1623 // Check if the arguments will overflow the stack. | 1623 // Check if the arguments will overflow the stack. |
1624 __ cmp(ecx, ebx); | 1624 __ cmp(ecx, ebx); |
1625 __ j(greater, &done, Label::kNear); // Signed comparison. | 1625 __ j(greater, &done, Label::kNear); // Signed comparison. |
1626 __ TailCallRuntime(Runtime::kThrowStackOverflow, 1, 1); | 1626 __ TailCallRuntime(Runtime::kThrowStackOverflow, 1); |
1627 __ bind(&done); | 1627 __ bind(&done); |
1628 } | 1628 } |
1629 | 1629 |
1630 // ----------- S t a t e ------------- | 1630 // ----------- S t a t e ------------- |
1631 // -- edi : target | 1631 // -- edi : target |
1632 // -- eax : args (a FixedArray built from argumentsList) | 1632 // -- eax : args (a FixedArray built from argumentsList) |
1633 // -- ebx : len (number of elements to push from args) | 1633 // -- ebx : len (number of elements to push from args) |
1634 // -- edx : new.target (checked to be constructor or undefined) | 1634 // -- edx : new.target (checked to be constructor or undefined) |
1635 // -- esp[0] : return address. | 1635 // -- esp[0] : return address. |
1636 // -- esp[4] : thisArgument | 1636 // -- esp[4] : thisArgument |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2314 // Compatible receiver check failed: pop return address, arguments and | 2314 // Compatible receiver check failed: pop return address, arguments and |
2315 // receiver and throw an Illegal Invocation exception. | 2315 // receiver and throw an Illegal Invocation exception. |
2316 __ bind(&receiver_check_failed); | 2316 __ bind(&receiver_check_failed); |
2317 __ Pop(eax); | 2317 __ Pop(eax); |
2318 __ PopReturnAddressTo(ebx); | 2318 __ PopReturnAddressTo(ebx); |
2319 __ lea(eax, Operand(eax, times_pointer_size, 1 * kPointerSize)); | 2319 __ lea(eax, Operand(eax, times_pointer_size, 1 * kPointerSize)); |
2320 __ add(esp, eax); | 2320 __ add(esp, eax); |
2321 __ PushReturnAddressFrom(ebx); | 2321 __ PushReturnAddressFrom(ebx); |
2322 { | 2322 { |
2323 FrameScope scope(masm, StackFrame::INTERNAL); | 2323 FrameScope scope(masm, StackFrame::INTERNAL); |
2324 __ TailCallRuntime(Runtime::kThrowIllegalInvocation, 0, 1); | 2324 __ TailCallRuntime(Runtime::kThrowIllegalInvocation, 0); |
2325 } | 2325 } |
2326 } | 2326 } |
2327 | 2327 |
2328 | 2328 |
2329 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 2329 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
2330 // Lookup the function in the JavaScript frame. | 2330 // Lookup the function in the JavaScript frame. |
2331 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 2331 __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
2332 { | 2332 { |
2333 FrameScope scope(masm, StackFrame::INTERNAL); | 2333 FrameScope scope(masm, StackFrame::INTERNAL); |
2334 // Pass function as argument. | 2334 // Pass function as argument. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2379 | 2379 |
2380 __ bind(&ok); | 2380 __ bind(&ok); |
2381 __ ret(0); | 2381 __ ret(0); |
2382 } | 2382 } |
2383 | 2383 |
2384 #undef __ | 2384 #undef __ |
2385 } // namespace internal | 2385 } // namespace internal |
2386 } // namespace v8 | 2386 } // namespace v8 |
2387 | 2387 |
2388 #endif // V8_TARGET_ARCH_X87 | 2388 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |