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

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

Issue 100243: Redo patch http://codereview.chromium.org/60035 (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
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 | « no previous file | 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 #ifdef ENABLE_DEBUGGER_SUPPORT 80 #ifdef ENABLE_DEBUGGER_SUPPORT
73 ExternalReference debug_step_in_fp = 81 ExternalReference debug_step_in_fp =
74 ExternalReference::debug_step_in_fp_address(); 82 ExternalReference::debug_step_in_fp_address();
75 __ cmp(Operand::StaticVariable(debug_step_in_fp), Immediate(0)); 83 __ cmp(Operand::StaticVariable(debug_step_in_fp), Immediate(0));
76 __ j(not_equal, &rt_call); 84 __ j(not_equal, &rt_call);
77 #endif 85 #endif
78 // Check that function is not a Smi.
79 __ test(edi, Immediate(kSmiTagMask));
80 __ j(zero, &rt_call);
81 // Check that function is a JSFunction
82 __ CmpObjectType(edi, JS_FUNCTION_TYPE, eax);
83 __ j(not_equal, &rt_call);
84 86
85 // Verified that the constructor is a JSFunction. 87 // Verified that the constructor is a JSFunction.
86 // Load the initial map and verify that it is in fact a map. 88 // Load the initial map and verify that it is in fact a map.
87 // edi: constructor 89 // edi: constructor
88 __ mov(eax, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset)); 90 __ mov(eax, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset));
89 // Will both indicate a NULL and a Smi 91 // Will both indicate a NULL and a Smi
90 __ test(eax, Immediate(kSmiTagMask)); 92 __ test(eax, Immediate(kSmiTagMask));
91 __ j(zero, &rt_call); 93 __ j(zero, &rt_call);
92 // edi: constructor 94 // edi: constructor
93 // eax: initial map (if proven valid below) 95 // eax: initial map (if proven valid below)
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 __ bind(&exit); 297 __ bind(&exit);
296 __ mov(ebx, Operand(esp, kPointerSize)); // get arguments count 298 __ mov(ebx, Operand(esp, kPointerSize)); // get arguments count
297 __ LeaveConstructFrame(); 299 __ LeaveConstructFrame();
298 300
299 // Remove caller arguments from the stack and return. 301 // Remove caller arguments from the stack and return.
300 ASSERT(kSmiTagSize == 1 && kSmiTag == 0); 302 ASSERT(kSmiTagSize == 1 && kSmiTag == 0);
301 __ pop(ecx); 303 __ pop(ecx);
302 __ lea(esp, Operand(esp, ebx, times_2, 1 * kPointerSize)); // 1 ~ receiver 304 __ lea(esp, Operand(esp, ebx, times_2, 1 * kPointerSize)); // 1 ~ receiver
303 __ push(ecx); 305 __ push(ecx);
304 __ ret(0); 306 __ ret(0);
307
308 // edi: called object
309 // eax: number of arguments
310 __ bind(&non_function_call);
311
312 // Set expected number of arguments to zero (not changing eax).
313 __ Set(ebx, Immediate(0));
314 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION);
315 __ jmp(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)),
316 RelocInfo::CODE_TARGET);
305 } 317 }
306 318
307 319
308 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, 320 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
309 bool is_construct) { 321 bool is_construct) {
310 // Clear the context before we push it when entering the JS frame. 322 // Clear the context before we push it when entering the JS frame.
311 __ xor_(esi, Operand(esi)); // clear esi 323 __ xor_(esi, Operand(esi)); // clear esi
312 324
313 // Enter an internal frame. 325 // Enter an internal frame.
314 __ EnterInternalFrame(); 326 __ EnterInternalFrame();
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 // Dont adapt arguments. 761 // Dont adapt arguments.
750 // ------------------------------------------- 762 // -------------------------------------------
751 __ bind(&dont_adapt_arguments); 763 __ bind(&dont_adapt_arguments);
752 __ jmp(Operand(edx)); 764 __ jmp(Operand(edx));
753 } 765 }
754 766
755 767
756 #undef __ 768 #undef __
757 769
758 } } // namespace v8::internal 770 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698