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

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

Issue 6880268: Sometimes avoid checking whether the receiver is an object in generated code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Removed int3. Created 9 years, 8 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/full-codegen.h ('k') | src/x64/full-codegen-x64.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 2058 matching lines...) Expand 10 before | Expand all | Expand 10 after
2069 arg_count, in_loop); 2069 arg_count, in_loop);
2070 __ mov(ecx, Operand(esp, (arg_count + 1) * kPointerSize)); // Key. 2070 __ mov(ecx, Operand(esp, (arg_count + 1) * kPointerSize)); // Key.
2071 EmitCallIC(ic, mode, expr->id()); 2071 EmitCallIC(ic, mode, expr->id());
2072 RecordJSReturnSite(expr); 2072 RecordJSReturnSite(expr);
2073 // Restore context register. 2073 // Restore context register.
2074 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 2074 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
2075 context()->DropAndPlug(1, eax); // Drop the key still on the stack. 2075 context()->DropAndPlug(1, eax); // Drop the key still on the stack.
2076 } 2076 }
2077 2077
2078 2078
2079 void FullCodeGenerator::EmitCallWithStub(Call* expr) { 2079 void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) {
2080 // Code common for calls using the call stub. 2080 // Code common for calls using the call stub.
2081 ZoneList<Expression*>* args = expr->arguments(); 2081 ZoneList<Expression*>* args = expr->arguments();
2082 int arg_count = args->length(); 2082 int arg_count = args->length();
2083 { PreservePositionScope scope(masm()->positions_recorder()); 2083 { PreservePositionScope scope(masm()->positions_recorder());
2084 for (int i = 0; i < arg_count; i++) { 2084 for (int i = 0; i < arg_count; i++) {
2085 VisitForStackValue(args->at(i)); 2085 VisitForStackValue(args->at(i));
2086 } 2086 }
2087 } 2087 }
2088 // Record source position for debugger. 2088 // Record source position for debugger.
2089 SetSourcePosition(expr->position()); 2089 SetSourcePosition(expr->position());
2090 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; 2090 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
2091 CallFunctionStub stub(arg_count, in_loop, RECEIVER_MIGHT_BE_VALUE); 2091 CallFunctionStub stub(arg_count, in_loop, flags);
2092 __ CallStub(&stub); 2092 __ CallStub(&stub);
2093 RecordJSReturnSite(expr); 2093 RecordJSReturnSite(expr);
2094 // Restore context register. 2094 // Restore context register.
2095 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 2095 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
2096 context()->DropAndPlug(1, eax); 2096 context()->DropAndPlug(1, eax);
2097 } 2097 }
2098 2098
2099 2099
2100 void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag, 2100 void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag,
2101 int arg_count) { 2101 int arg_count) {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2220 __ jmp(&call); 2220 __ jmp(&call);
2221 __ bind(&done); 2221 __ bind(&done);
2222 // Push function. 2222 // Push function.
2223 __ push(eax); 2223 __ push(eax);
2224 // Push global receiver. 2224 // Push global receiver.
2225 __ mov(ebx, GlobalObjectOperand()); 2225 __ mov(ebx, GlobalObjectOperand());
2226 __ push(FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset)); 2226 __ push(FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset));
2227 __ bind(&call); 2227 __ bind(&call);
2228 } 2228 }
2229 2229
2230 EmitCallWithStub(expr); 2230 // The receiver is either the global receiver or a JSObject found by
2231 // LoadContextSlot.
2232 EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS);
2231 } else if (fun->AsProperty() != NULL) { 2233 } else if (fun->AsProperty() != NULL) {
2232 // Call to an object property. 2234 // Call to an object property.
2233 Property* prop = fun->AsProperty(); 2235 Property* prop = fun->AsProperty();
2234 Literal* key = prop->key()->AsLiteral(); 2236 Literal* key = prop->key()->AsLiteral();
2235 if (key != NULL && key->handle()->IsSymbol()) { 2237 if (key != NULL && key->handle()->IsSymbol()) {
2236 // Call to a named property, use call IC. 2238 // Call to a named property, use call IC.
2237 { PreservePositionScope scope(masm()->positions_recorder()); 2239 { PreservePositionScope scope(masm()->positions_recorder());
2238 VisitForStackValue(prop->obj()); 2240 VisitForStackValue(prop->obj());
2239 } 2241 }
2240 EmitCallWithIC(expr, key->handle(), RelocInfo::CODE_TARGET); 2242 EmitCallWithIC(expr, key->handle(), RelocInfo::CODE_TARGET);
(...skipping 17 matching lines...) Expand all
2258 // Record source code position for IC call. 2260 // Record source code position for IC call.
2259 SetSourcePosition(prop->position()); 2261 SetSourcePosition(prop->position());
2260 2262
2261 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); 2263 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
2262 EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(prop)); 2264 EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(prop));
2263 // Push result (function). 2265 // Push result (function).
2264 __ push(eax); 2266 __ push(eax);
2265 // Push Global receiver. 2267 // Push Global receiver.
2266 __ mov(ecx, GlobalObjectOperand()); 2268 __ mov(ecx, GlobalObjectOperand());
2267 __ push(FieldOperand(ecx, GlobalObject::kGlobalReceiverOffset)); 2269 __ push(FieldOperand(ecx, GlobalObject::kGlobalReceiverOffset));
2268 EmitCallWithStub(expr); 2270 EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS);
2269 } else { 2271 } else {
2270 { PreservePositionScope scope(masm()->positions_recorder()); 2272 { PreservePositionScope scope(masm()->positions_recorder());
2271 VisitForStackValue(prop->obj()); 2273 VisitForStackValue(prop->obj());
2272 } 2274 }
2273 EmitKeyedCallWithIC(expr, prop->key(), RelocInfo::CODE_TARGET); 2275 EmitKeyedCallWithIC(expr, prop->key(), RelocInfo::CODE_TARGET);
2274 } 2276 }
2275 } 2277 }
2276 } else { 2278 } else {
2277 { PreservePositionScope scope(masm()->positions_recorder()); 2279 { PreservePositionScope scope(masm()->positions_recorder());
2278 VisitForStackValue(fun); 2280 VisitForStackValue(fun);
2279 } 2281 }
2280 // Load global receiver object. 2282 // Load global receiver object.
2281 __ mov(ebx, GlobalObjectOperand()); 2283 __ mov(ebx, GlobalObjectOperand());
2282 __ push(FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset)); 2284 __ push(FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset));
2283 // Emit function call. 2285 // Emit function call.
2284 EmitCallWithStub(expr); 2286 EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS);
2285 } 2287 }
2286 2288
2287 #ifdef DEBUG 2289 #ifdef DEBUG
2288 // RecordJSReturnSite should have been called. 2290 // RecordJSReturnSite should have been called.
2289 ASSERT(expr->return_is_recorded_); 2291 ASSERT(expr->return_is_recorded_);
2290 #endif 2292 #endif
2291 } 2293 }
2292 2294
2293 2295
2294 void FullCodeGenerator::VisitCallNew(CallNew* expr) { 2296 void FullCodeGenerator::VisitCallNew(CallNew* expr) {
(...skipping 2039 matching lines...) Expand 10 before | Expand all | Expand 10 after
4334 // And return. 4336 // And return.
4335 __ ret(0); 4337 __ ret(0);
4336 } 4338 }
4337 4339
4338 4340
4339 #undef __ 4341 #undef __
4340 4342
4341 } } // namespace v8::internal 4343 } } // namespace v8::internal
4342 4344
4343 #endif // V8_TARGET_ARCH_IA32 4345 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen.h ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698