Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: src/ia32/codegen-ia32.cc

Issue 3156028: Change code pointer in function objects to a pointer to the first... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3405 matching lines...) Expand 10 before | Expand all | Expand 10 after
3416 STATIC_ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); 3416 STATIC_ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1);
3417 __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx); 3417 __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx);
3418 __ j(below, &build_args); 3418 __ j(below, &build_args);
3419 3419
3420 // Check that applicand.apply is Function.prototype.apply. 3420 // Check that applicand.apply is Function.prototype.apply.
3421 __ mov(eax, Operand(esp, kPointerSize)); 3421 __ mov(eax, Operand(esp, kPointerSize));
3422 __ test(eax, Immediate(kSmiTagMask)); 3422 __ test(eax, Immediate(kSmiTagMask));
3423 __ j(zero, &build_args); 3423 __ j(zero, &build_args);
3424 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ecx); 3424 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ecx);
3425 __ j(not_equal, &build_args); 3425 __ j(not_equal, &build_args);
3426 __ mov(ecx, FieldOperand(eax, JSFunction::kCodeEntryOffset));
3427 __ sub(Operand(ecx), Immediate(Code::kHeaderSize - kHeapObjectTag));
3426 Handle<Code> apply_code(Builtins::builtin(Builtins::FunctionApply)); 3428 Handle<Code> apply_code(Builtins::builtin(Builtins::FunctionApply));
3427 __ cmp(FieldOperand(eax, JSFunction::kCodeOffset), Immediate(apply_code)); 3429 __ cmp(Operand(ecx), Immediate(apply_code));
3428 __ j(not_equal, &build_args); 3430 __ j(not_equal, &build_args);
3429 3431
3430 // Check that applicand is a function. 3432 // Check that applicand is a function.
3431 __ mov(edi, Operand(esp, 2 * kPointerSize)); 3433 __ mov(edi, Operand(esp, 2 * kPointerSize));
3432 __ test(edi, Immediate(kSmiTagMask)); 3434 __ test(edi, Immediate(kSmiTagMask));
3433 __ j(zero, &build_args); 3435 __ j(zero, &build_args);
3434 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); 3436 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
3435 __ j(not_equal, &build_args); 3437 __ j(not_equal, &build_args);
3436 3438
3437 // Copy the arguments to this function possibly from the 3439 // Copy the arguments to this function possibly from the
(...skipping 6370 matching lines...) Expand 10 before | Expand all | Expand 10 after
9808 __ mov(FieldOperand(eax, JSObject::kElementsOffset), ebx); 9810 __ mov(FieldOperand(eax, JSObject::kElementsOffset), ebx);
9809 __ mov(FieldOperand(eax, JSFunction::kPrototypeOrInitialMapOffset), 9811 __ mov(FieldOperand(eax, JSFunction::kPrototypeOrInitialMapOffset),
9810 Immediate(Factory::the_hole_value())); 9812 Immediate(Factory::the_hole_value()));
9811 __ mov(FieldOperand(eax, JSFunction::kSharedFunctionInfoOffset), edx); 9813 __ mov(FieldOperand(eax, JSFunction::kSharedFunctionInfoOffset), edx);
9812 __ mov(FieldOperand(eax, JSFunction::kContextOffset), esi); 9814 __ mov(FieldOperand(eax, JSFunction::kContextOffset), esi);
9813 __ mov(FieldOperand(eax, JSFunction::kLiteralsOffset), ebx); 9815 __ mov(FieldOperand(eax, JSFunction::kLiteralsOffset), ebx);
9814 9816
9815 // Initialize the code pointer in the function to be the one 9817 // Initialize the code pointer in the function to be the one
9816 // found in the shared function info object. 9818 // found in the shared function info object.
9817 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kCodeOffset)); 9819 __ mov(edx, FieldOperand(edx, SharedFunctionInfo::kCodeOffset));
9818 __ mov(FieldOperand(eax, JSFunction::kCodeOffset), edx); 9820 __ lea(edx, FieldOperand(edx, Code::kHeaderSize));
9821 __ mov(FieldOperand(eax, JSFunction::kCodeEntryOffset), edx);
9819 9822
9820 // Return and remove the on-stack parameter. 9823 // Return and remove the on-stack parameter.
9821 __ ret(1 * kPointerSize); 9824 __ ret(1 * kPointerSize);
9822 9825
9823 // Create a new closure through the slower runtime call. 9826 // Create a new closure through the slower runtime call.
9824 __ bind(&gc); 9827 __ bind(&gc);
9825 __ pop(ecx); // Temporarily remove return address. 9828 __ pop(ecx); // Temporarily remove return address.
9826 __ pop(edx); 9829 __ pop(edx);
9827 __ push(esi); 9830 __ push(esi);
9828 __ push(edx); 9831 __ push(edx);
(...skipping 4577 matching lines...) Expand 10 before | Expand all | Expand 10 after
14406 masm.GetCode(&desc); 14409 masm.GetCode(&desc);
14407 // Call the function from C++. 14410 // Call the function from C++.
14408 return FUNCTION_CAST<MemCopyFunction>(buffer); 14411 return FUNCTION_CAST<MemCopyFunction>(buffer);
14409 } 14412 }
14410 14413
14411 #undef __ 14414 #undef __
14412 14415
14413 } } // namespace v8::internal 14416 } } // namespace v8::internal
14414 14417
14415 #endif // V8_TARGET_ARCH_IA32 14418 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698