| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); | 73 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); |
| 74 } | 74 } |
| 75 | 75 |
| 76 | 76 |
| 77 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) { | 77 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) { |
| 78 // ----------- S t a t e ------------- | 78 // ----------- S t a t e ------------- |
| 79 // -- eax: number of arguments | 79 // -- eax: number of arguments |
| 80 // -- edi: constructor function | 80 // -- edi: constructor function |
| 81 // ----------------------------------- | 81 // ----------------------------------- |
| 82 | 82 |
| 83 Label non_function_call; | 83 Label slow, non_function_call; |
| 84 // Check that function is not a smi. | 84 // Check that function is not a smi. |
| 85 __ JumpIfSmi(edi, &non_function_call); | 85 __ JumpIfSmi(edi, &non_function_call); |
| 86 // Check that function is a JSFunction. | 86 // Check that function is a JSFunction. |
| 87 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); | 87 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); |
| 88 __ j(not_equal, &non_function_call); | 88 __ j(not_equal, &slow); |
| 89 | 89 |
| 90 // Jump to the function-specific construct stub. | 90 // Jump to the function-specific construct stub. |
| 91 __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 91 __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
| 92 __ mov(ebx, FieldOperand(ebx, SharedFunctionInfo::kConstructStubOffset)); | 92 __ mov(ebx, FieldOperand(ebx, SharedFunctionInfo::kConstructStubOffset)); |
| 93 __ lea(ebx, FieldOperand(ebx, Code::kHeaderSize)); | 93 __ lea(ebx, FieldOperand(ebx, Code::kHeaderSize)); |
| 94 __ jmp(Operand(ebx)); | 94 __ jmp(Operand(ebx)); |
| 95 | 95 |
| 96 // edi: called object | 96 // edi: called object |
| 97 // eax: number of arguments | 97 // eax: number of arguments |
| 98 // ecx: object map |
| 99 Label do_call; |
| 100 __ bind(&slow); |
| 101 __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE); |
| 102 __ j(not_equal, &non_function_call); |
| 103 __ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); |
| 104 __ jmp(&do_call); |
| 105 |
| 98 __ bind(&non_function_call); | 106 __ bind(&non_function_call); |
| 107 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); |
| 108 __ bind(&do_call); |
| 99 // Set expected number of arguments to zero (not changing eax). | 109 // Set expected number of arguments to zero (not changing eax). |
| 100 __ Set(ebx, Immediate(0)); | 110 __ Set(ebx, Immediate(0)); |
| 101 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); | |
| 102 Handle<Code> arguments_adaptor = | 111 Handle<Code> arguments_adaptor = |
| 103 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 112 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); |
| 104 __ SetCallKind(ecx, CALL_AS_METHOD); | 113 __ SetCallKind(ecx, CALL_AS_METHOD); |
| 105 __ jmp(arguments_adaptor, RelocInfo::CODE_TARGET); | 114 __ jmp(arguments_adaptor, RelocInfo::CODE_TARGET); |
| 106 } | 115 } |
| 107 | 116 |
| 108 | 117 |
| 109 static void Generate_JSConstructStubHelper(MacroAssembler* masm, | 118 static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
| 110 bool is_api_function, | 119 bool is_api_function, |
| 111 bool count_constructions) { | 120 bool count_constructions) { |
| (...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1648 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1657 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
| 1649 generator.Generate(); | 1658 generator.Generate(); |
| 1650 } | 1659 } |
| 1651 | 1660 |
| 1652 | 1661 |
| 1653 #undef __ | 1662 #undef __ |
| 1654 } | 1663 } |
| 1655 } // namespace v8::internal | 1664 } // namespace v8::internal |
| 1656 | 1665 |
| 1657 #endif // V8_TARGET_ARCH_IA32 | 1666 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |