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

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

Issue 108008: Merge change that allows the API call-as-function handlers on... (Closed) Base URL: http://v8.googlecode.com/svn/branches/1.1/
Patch Set: '' Created 11 years, 7 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/api.cc ('k') | test/cctest/test-api.cc » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 __ JumpToBuiltin(ExternalReference(id)); 47 __ JumpToBuiltin(ExternalReference(id));
48 } 48 }
49 49
50 50
51 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) { 51 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) {
52 // ----------- S t a t e ------------- 52 // ----------- S t a t e -------------
53 // -- eax: number of arguments 53 // -- eax: number of arguments
54 // -- edi: constructor function 54 // -- edi: constructor function
55 // ----------------------------------- 55 // -----------------------------------
56 56
57 Label non_function_call;
58 // Check that function is not a smi.
59 __ test(edi, Immediate(kSmiTagMask));
60 __ j(zero, &non_function_call);
61 // Check that function is a JSFunction.
62 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
63 __ j(not_equal, &non_function_call);
64
57 // Enter a construct frame. 65 // Enter a construct frame.
58 __ EnterConstructFrame(); 66 __ EnterConstructFrame();
59 67
60 // Store a smi-tagged arguments count on the stack. 68 // Store a smi-tagged arguments count on the stack.
61 __ shl(eax, kSmiTagSize); 69 __ shl(eax, kSmiTagSize);
62 __ push(eax); 70 __ push(eax);
63 71
64 // Push the function to invoke on the stack. 72 // Push the function to invoke on the stack.
65 __ push(edi); 73 __ push(edi);
66 74
67 // Try to allocate the object without transitioning into C code. If any of the 75 // Try to allocate the object without transitioning into C code. If any of the
68 // preconditions is not met, the code bails out to the runtime call. 76 // preconditions is not met, the code bails out to the runtime call.
69 Label rt_call, allocated; 77 Label rt_call, allocated;
70 if (FLAG_inline_new) { 78 if (FLAG_inline_new) {
71 Label undo_allocation; 79 Label undo_allocation;
72 ExternalReference debug_step_in_fp = 80 ExternalReference debug_step_in_fp =
73 ExternalReference::debug_step_in_fp_address(); 81 ExternalReference::debug_step_in_fp_address();
74 __ cmp(Operand::StaticVariable(debug_step_in_fp), Immediate(0)); 82 __ cmp(Operand::StaticVariable(debug_step_in_fp), Immediate(0));
75 __ j(not_equal, &rt_call); 83 __ j(not_equal, &rt_call);
76 // Check that function is not a Smi.
77 __ test(edi, Immediate(kSmiTagMask));
78 __ j(zero, &rt_call);
79 // Check that function is a JSFunction
80 __ CmpObjectType(edi, JS_FUNCTION_TYPE, eax);
81 __ j(not_equal, &rt_call);
82 84
83 // Verified that the constructor is a JSFunction. 85 // Verified that the constructor is a JSFunction.
84 // Load the initial map and verify that it is in fact a map. 86 // Load the initial map and verify that it is in fact a map.
85 // edi: constructor 87 // edi: constructor
86 __ mov(eax, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset)); 88 __ mov(eax, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset));
87 // Will both indicate a NULL and a Smi 89 // Will both indicate a NULL and a Smi
88 __ test(eax, Immediate(kSmiTagMask)); 90 __ test(eax, Immediate(kSmiTagMask));
89 __ j(zero, &rt_call); 91 __ j(zero, &rt_call);
90 // edi: constructor 92 // edi: constructor
91 // eax: initial map (if proven valid below) 93 // eax: initial map (if proven valid below)
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 __ bind(&exit); 295 __ bind(&exit);
294 __ mov(ebx, Operand(esp, kPointerSize)); // get arguments count 296 __ mov(ebx, Operand(esp, kPointerSize)); // get arguments count
295 __ LeaveConstructFrame(); 297 __ LeaveConstructFrame();
296 298
297 // Remove caller arguments from the stack and return. 299 // Remove caller arguments from the stack and return.
298 ASSERT(kSmiTagSize == 1 && kSmiTag == 0); 300 ASSERT(kSmiTagSize == 1 && kSmiTag == 0);
299 __ pop(ecx); 301 __ pop(ecx);
300 __ lea(esp, Operand(esp, ebx, times_2, 1 * kPointerSize)); // 1 ~ receiver 302 __ lea(esp, Operand(esp, ebx, times_2, 1 * kPointerSize)); // 1 ~ receiver
301 __ push(ecx); 303 __ push(ecx);
302 __ ret(0); 304 __ ret(0);
305
306 // edi: called object
307 // eax: number of arguments
308 __ bind(&non_function_call);
309
310 // Set expected number of arguments to zero (not changing eax).
311 __ Set(ebx, Immediate(0));
312 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION);
313 __ jmp(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)),
314 RelocInfo::CODE_TARGET);
303 } 315 }
304 316
305 317
306 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, 318 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
307 bool is_construct) { 319 bool is_construct) {
308 // Clear the context before we push it when entering the JS frame. 320 // Clear the context before we push it when entering the JS frame.
309 __ xor_(esi, Operand(esi)); // clear esi 321 __ xor_(esi, Operand(esi)); // clear esi
310 322
311 // Enter an internal frame. 323 // Enter an internal frame.
312 __ EnterInternalFrame(); 324 __ EnterInternalFrame();
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 // Dont adapt arguments. 759 // Dont adapt arguments.
748 // ------------------------------------------- 760 // -------------------------------------------
749 __ bind(&dont_adapt_arguments); 761 __ bind(&dont_adapt_arguments);
750 __ jmp(Operand(edx)); 762 __ jmp(Operand(edx));
751 } 763 }
752 764
753 765
754 #undef __ 766 #undef __
755 767
756 } } // namespace v8::internal 768 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698