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

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

Issue 10103035: Share optimized code for closures. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: added x64 and ARM ports Created 8 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 void LCodeGen::WriteTranslation(LEnvironment* environment, 360 void LCodeGen::WriteTranslation(LEnvironment* environment,
361 Translation* translation) { 361 Translation* translation) {
362 if (environment == NULL) return; 362 if (environment == NULL) return;
363 363
364 // The translation includes one command per value in the environment. 364 // The translation includes one command per value in the environment.
365 int translation_size = environment->values()->length(); 365 int translation_size = environment->values()->length();
366 // The output frame height does not include the parameters. 366 // The output frame height does not include the parameters.
367 int height = translation_size - environment->parameter_count(); 367 int height = translation_size - environment->parameter_count();
368 368
369 WriteTranslation(environment->outer(), translation); 369 WriteTranslation(environment->outer(), translation);
370 int closure_id = DefineDeoptimizationLiteral(environment->closure()); 370 int closure_id = *info()->closure() != *environment->closure()
371 ? DefineDeoptimizationLiteral(environment->closure())
372 : Translation::kSelfLiteralId;
371 switch (environment->frame_type()) { 373 switch (environment->frame_type()) {
372 case JS_FUNCTION: 374 case JS_FUNCTION:
373 translation->BeginJSFrame(environment->ast_id(), closure_id, height); 375 translation->BeginJSFrame(environment->ast_id(), closure_id, height);
374 break; 376 break;
375 case JS_CONSTRUCT: 377 case JS_CONSTRUCT:
376 translation->BeginConstructStubFrame(closure_id, translation_size); 378 translation->BeginConstructStubFrame(closure_id, translation_size);
377 break; 379 break;
378 case ARGUMENTS_ADAPTOR: 380 case ARGUMENTS_ADAPTOR:
379 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); 381 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size);
380 break; 382 break;
(...skipping 2307 matching lines...) Expand 10 before | Expand all | Expand 10 after
2688 } 2690 }
2689 2691
2690 2692
2691 void LCodeGen::DoDrop(LDrop* instr) { 2693 void LCodeGen::DoDrop(LDrop* instr) {
2692 __ Drop(instr->count()); 2694 __ Drop(instr->count());
2693 } 2695 }
2694 2696
2695 2697
2696 void LCodeGen::DoThisFunction(LThisFunction* instr) { 2698 void LCodeGen::DoThisFunction(LThisFunction* instr) {
2697 Register result = ToRegister(instr->result()); 2699 Register result = ToRegister(instr->result());
2698 __ LoadHeapObject(result, instr->hydrogen()->closure()); 2700 __ mov(result, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
2699 } 2701 }
2700 2702
2701 2703
2702 void LCodeGen::DoContext(LContext* instr) { 2704 void LCodeGen::DoContext(LContext* instr) {
2703 Register result = ToRegister(instr->result()); 2705 Register result = ToRegister(instr->result());
2704 __ mov(result, Operand(ebp, StandardFrameConstants::kContextOffset)); 2706 __ mov(result, Operand(ebp, StandardFrameConstants::kContextOffset));
2705 } 2707 }
2706 2708
2707 2709
2708 void LCodeGen::DoOuterContext(LOuterContext* instr) { 2710 void LCodeGen::DoOuterContext(LOuterContext* instr) {
(...skipping 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after
5062 FixedArray::kHeaderSize - kPointerSize)); 5064 FixedArray::kHeaderSize - kPointerSize));
5063 __ bind(&done); 5065 __ bind(&done);
5064 } 5066 }
5065 5067
5066 5068
5067 #undef __ 5069 #undef __
5068 5070
5069 } } // namespace v8::internal 5071 } } // namespace v8::internal
5070 5072
5071 #endif // V8_TARGET_ARCH_IA32 5073 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698