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 3417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3428 STATIC_ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); | 3428 STATIC_ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); |
3429 __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx); | 3429 __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx); |
3430 __ j(below, &build_args); | 3430 __ j(below, &build_args); |
3431 | 3431 |
3432 // Check that applicand.apply is Function.prototype.apply. | 3432 // Check that applicand.apply is Function.prototype.apply. |
3433 __ mov(eax, Operand(esp, kPointerSize)); | 3433 __ mov(eax, Operand(esp, kPointerSize)); |
3434 __ test(eax, Immediate(kSmiTagMask)); | 3434 __ test(eax, Immediate(kSmiTagMask)); |
3435 __ j(zero, &build_args); | 3435 __ j(zero, &build_args); |
3436 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ecx); | 3436 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ecx); |
3437 __ j(not_equal, &build_args); | 3437 __ j(not_equal, &build_args); |
3438 __ mov(ecx, FieldOperand(eax, JSFunction::kSharedFunctionInfoOffset)); | |
3439 Handle<Code> apply_code(Builtins::builtin(Builtins::FunctionApply)); | 3438 Handle<Code> apply_code(Builtins::builtin(Builtins::FunctionApply)); |
3440 __ cmp(FieldOperand(ecx, SharedFunctionInfo::kCodeOffset), | 3439 __ cmp(FieldOperand(eax, JSFunction::kCodeOffset), Immediate(apply_code)); |
3441 Immediate(apply_code)); | |
3442 __ j(not_equal, &build_args); | 3440 __ j(not_equal, &build_args); |
3443 | 3441 |
3444 // Check that applicand is a function. | 3442 // Check that applicand is a function. |
3445 __ mov(edi, Operand(esp, 2 * kPointerSize)); | 3443 __ mov(edi, Operand(esp, 2 * kPointerSize)); |
3446 __ test(edi, Immediate(kSmiTagMask)); | 3444 __ test(edi, Immediate(kSmiTagMask)); |
3447 __ j(zero, &build_args); | 3445 __ j(zero, &build_args); |
3448 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); | 3446 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); |
3449 __ j(not_equal, &build_args); | 3447 __ j(not_equal, &build_args); |
3450 | 3448 |
3451 // Copy the arguments to this function possibly from the | 3449 // Copy the arguments to this function possibly from the |
(...skipping 6231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9683 // write barrier because the allocated object is in new space. | 9681 // write barrier because the allocated object is in new space. |
9684 __ mov(ebx, Immediate(Factory::empty_fixed_array())); | 9682 __ mov(ebx, Immediate(Factory::empty_fixed_array())); |
9685 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), ebx); | 9683 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), ebx); |
9686 __ mov(FieldOperand(eax, JSObject::kElementsOffset), ebx); | 9684 __ mov(FieldOperand(eax, JSObject::kElementsOffset), ebx); |
9687 __ mov(FieldOperand(eax, JSFunction::kPrototypeOrInitialMapOffset), | 9685 __ mov(FieldOperand(eax, JSFunction::kPrototypeOrInitialMapOffset), |
9688 Immediate(Factory::the_hole_value())); | 9686 Immediate(Factory::the_hole_value())); |
9689 __ mov(FieldOperand(eax, JSFunction::kSharedFunctionInfoOffset), edx); | 9687 __ mov(FieldOperand(eax, JSFunction::kSharedFunctionInfoOffset), edx); |
9690 __ mov(FieldOperand(eax, JSFunction::kContextOffset), esi); | 9688 __ mov(FieldOperand(eax, JSFunction::kContextOffset), esi); |
9691 __ mov(FieldOperand(eax, JSFunction::kLiteralsOffset), ebx); | 9689 __ mov(FieldOperand(eax, JSFunction::kLiteralsOffset), ebx); |
9692 | 9690 |
| 9691 // Initialize the code pointer in the function to be the one |
| 9692 // found in the shared function info object. |
| 9693 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kCodeOffset)); |
| 9694 __ mov(FieldOperand(eax, JSFunction::kCodeOffset), edx); |
| 9695 |
9693 // Return and remove the on-stack parameter. | 9696 // Return and remove the on-stack parameter. |
9694 __ ret(1 * kPointerSize); | 9697 __ ret(1 * kPointerSize); |
9695 | 9698 |
9696 // Create a new closure through the slower runtime call. | 9699 // Create a new closure through the slower runtime call. |
9697 __ bind(&gc); | 9700 __ bind(&gc); |
9698 __ pop(ecx); // Temporarily remove return address. | 9701 __ pop(ecx); // Temporarily remove return address. |
9699 __ pop(edx); | 9702 __ pop(edx); |
9700 __ push(esi); | 9703 __ push(esi); |
9701 __ push(edx); | 9704 __ push(edx); |
9702 __ push(ecx); // Restore return address. | 9705 __ push(ecx); // Restore return address. |
(...skipping 4558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14261 masm.GetCode(&desc); | 14264 masm.GetCode(&desc); |
14262 // Call the function from C++. | 14265 // Call the function from C++. |
14263 return FUNCTION_CAST<MemCopyFunction>(buffer); | 14266 return FUNCTION_CAST<MemCopyFunction>(buffer); |
14264 } | 14267 } |
14265 | 14268 |
14266 #undef __ | 14269 #undef __ |
14267 | 14270 |
14268 } } // namespace v8::internal | 14271 } } // namespace v8::internal |
14269 | 14272 |
14270 #endif // V8_TARGET_ARCH_IA32 | 14273 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |