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

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

Issue 8883011: Implement ICs for constructor calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years 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/full-codegen.cc ('k') | src/ia32/full-codegen-ia32.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 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // ----------------------------------- 81 // -----------------------------------
82 82
83 Label slow, 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, &slow); 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 ParameterCount actual(eax);
92 __ mov(ebx, FieldOperand(ebx, SharedFunctionInfo::kConstructStubOffset)); 92 __ InvokeConstruct(edi, actual);
93 __ lea(ebx, FieldOperand(ebx, Code::kHeaderSize));
94 __ jmp(ebx);
95 93
96 // edi: called object 94 // edi: called object
97 // eax: number of arguments 95 // eax: number of arguments
98 // ecx: object map 96 // ecx: object map
99 Label do_call; 97 Label do_call;
100 __ bind(&slow); 98 __ bind(&slow);
101 __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE); 99 __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE);
102 __ j(not_equal, &non_function_call); 100 __ j(not_equal, &non_function_call);
103 __ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); 101 __ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR);
104 __ jmp(&do_call); 102 __ jmp(&do_call);
105 103
106 __ bind(&non_function_call); 104 __ bind(&non_function_call);
107 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); 105 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR);
108 __ bind(&do_call); 106 __ bind(&do_call);
109 // Set expected number of arguments to zero (not changing eax). 107 // Set expected number of arguments to zero (not changing eax).
110 __ Set(ebx, Immediate(0)); 108 __ Set(ebx, Immediate(0));
111 Handle<Code> arguments_adaptor = 109 Handle<Code> arguments_adaptor =
112 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); 110 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline();
113 __ SetCallKind(ecx, CALL_AS_METHOD); 111 __ SetCallKind(ecx, CALL_AS_METHOD);
114 __ jmp(arguments_adaptor, RelocInfo::CODE_TARGET); 112 __ jmp(arguments_adaptor, RelocInfo::CODE_TARGET);
115 } 113 }
116 114
117 115
118 static void Generate_JSConstructStubHelper(MacroAssembler* masm, 116 static void Generate_JSConstructStubHelper(MacroAssembler* masm,
119 bool is_api_function, 117 bool is_api_function,
120 bool count_constructions) { 118 bool count_constructions) {
119 // ----------- S t a t e -------------
120 // -- eax: number of arguments
121 // -- edi: constructor function
122 // -----------------------------------
123
121 // Should never count constructions for api objects. 124 // Should never count constructions for api objects.
122 ASSERT(!is_api_function || !count_constructions); 125 ASSERT(!is_api_function || !count_constructions);
123 126
124 // Enter a construct frame. 127 // Enter a construct frame.
125 { 128 {
126 FrameScope scope(masm, StackFrame::CONSTRUCT); 129 FrameScope scope(masm, StackFrame::CONSTRUCT);
127 130
128 // Store a smi-tagged arguments count on the stack. 131 // Store a smi-tagged arguments count on the stack.
129 __ SmiTag(eax); 132 __ SmiTag(eax);
130 __ push(eax); 133 __ push(eax);
(...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); 1680 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR);
1678 generator.Generate(); 1681 generator.Generate();
1679 } 1682 }
1680 1683
1681 1684
1682 #undef __ 1685 #undef __
1683 } 1686 }
1684 } // namespace v8::internal 1687 } // namespace v8::internal
1685 1688
1686 #endif // V8_TARGET_ARCH_IA32 1689 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen.cc ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698