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

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

Issue 8932004: Implement target cache 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
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 2303 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 ZoneList<Expression*>* args = expr->arguments(); 2314 ZoneList<Expression*>* args = expr->arguments();
2315 int arg_count = args->length(); 2315 int arg_count = args->length();
2316 for (int i = 0; i < arg_count; i++) { 2316 for (int i = 0; i < arg_count; i++) {
2317 VisitForStackValue(args->at(i)); 2317 VisitForStackValue(args->at(i));
2318 } 2318 }
2319 2319
2320 // Call the construct call builtin that handles allocation and 2320 // Call the construct call builtin that handles allocation and
2321 // constructor invocation. 2321 // constructor invocation.
2322 SetSourcePosition(expr->position()); 2322 SetSourcePosition(expr->position());
2323 2323
2324 // Load function and argument count into edi and eax. 2324 // Load function and argument count into edi and eax. Record call targets
2325 // in unoptimized code, but not in the snapshot.
2326 bool record_call_target = !Serializer::enabled();
2327 CallFunctionFlags flags =
2328 record_call_target ? RECORD_CALL_TARGET : NO_CALL_FUNCTION_FLAGS;
2329 CallConstructStub stub(flags);
2325 __ SafeSet(eax, Immediate(arg_count)); 2330 __ SafeSet(eax, Immediate(arg_count));
2326 __ mov(edi, Operand(esp, arg_count * kPointerSize)); 2331 __ mov(edi, Operand(esp, arg_count * kPointerSize));
2332 __ call(stub.GetCode(), RelocInfo::CODE_TARGET, expr->id());
Vyacheslav Egorov (Chromium) 2012/01/23 10:39:52 RelocInfo::CONSTRUCT_CALL
Michael Starzinger 2012/01/25 11:42:29 Done. Required some changes in the debugger.
2327 2333
2328 Handle<Code> construct_builtin = 2334 // There is a one element cache in the instruction stream.
2329 isolate()->builtins()->JSConstructCall(); 2335 if (record_call_target) {
Vyacheslav Egorov (Chromium) 2012/01/23 10:39:52 I am curious if you can introduce helper method (e
Michael Starzinger 2012/01/25 11:42:29 Done. No longer needed with new approach.
2330 __ call(construct_builtin, RelocInfo::CONSTRUCT_CALL); 2336 #ifdef DEBUG
2337 int return_site_offset = masm()->pc_offset();
2338 #endif
2339 Handle<Object> uninitialized =
2340 CallConstructStub::UninitializedSentinel(isolate());
2341 Handle<JSGlobalPropertyCell> cell =
2342 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized);
2343 __ test(eax, Immediate(cell));
2344 // Patching code in the stub assumes the opcode is 1 byte and there is
2345 // word for a pointer in the operand.
2346 ASSERT(masm()->pc_offset() - return_site_offset >= 1 + kPointerSize);
2347 }
2348
2331 context()->Plug(eax); 2349 context()->Plug(eax);
2332 } 2350 }
2333 2351
2334 2352
2335 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 2353 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
2336 ZoneList<Expression*>* args = expr->arguments(); 2354 ZoneList<Expression*>* args = expr->arguments();
2337 ASSERT(args->length() == 1); 2355 ASSERT(args->length() == 1);
2338 2356
2339 VisitForAccumulatorValue(args->at(0)); 2357 VisitForAccumulatorValue(args->at(0));
2340 2358
(...skipping 2039 matching lines...) Expand 10 before | Expand all | Expand 10 after
4380 *context_length = 0; 4398 *context_length = 0;
4381 return previous_; 4399 return previous_;
4382 } 4400 }
4383 4401
4384 4402
4385 #undef __ 4403 #undef __
4386 4404
4387 } } // namespace v8::internal 4405 } } // namespace v8::internal
4388 4406
4389 #endif // V8_TARGET_ARCH_IA32 4407 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698