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/x64/lithium-codegen-x64.cc

Issue 10103035: Share optimized code for closures. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 6 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/x64/deoptimizer-x64.cc ('k') | test/mjsunit/compiler/optimized-closures.js » ('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 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;
373
371 switch (environment->frame_type()) { 374 switch (environment->frame_type()) {
372 case JS_FUNCTION: 375 case JS_FUNCTION:
373 translation->BeginJSFrame(environment->ast_id(), closure_id, height); 376 translation->BeginJSFrame(environment->ast_id(), closure_id, height);
374 break; 377 break;
375 case JS_CONSTRUCT: 378 case JS_CONSTRUCT:
376 translation->BeginConstructStubFrame(closure_id, translation_size); 379 translation->BeginConstructStubFrame(closure_id, translation_size);
377 break; 380 break;
378 case ARGUMENTS_ADAPTOR: 381 case ARGUMENTS_ADAPTOR:
379 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); 382 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size);
380 break; 383 break;
(...skipping 2343 matching lines...) Expand 10 before | Expand all | Expand 10 after
2724 } 2727 }
2725 2728
2726 2729
2727 void LCodeGen::DoDrop(LDrop* instr) { 2730 void LCodeGen::DoDrop(LDrop* instr) {
2728 __ Drop(instr->count()); 2731 __ Drop(instr->count());
2729 } 2732 }
2730 2733
2731 2734
2732 void LCodeGen::DoThisFunction(LThisFunction* instr) { 2735 void LCodeGen::DoThisFunction(LThisFunction* instr) {
2733 Register result = ToRegister(instr->result()); 2736 Register result = ToRegister(instr->result());
2734 __ LoadHeapObject(result, instr->hydrogen()->closure()); 2737 __ movq(result, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
2735 } 2738 }
2736 2739
2737 2740
2738 void LCodeGen::DoContext(LContext* instr) { 2741 void LCodeGen::DoContext(LContext* instr) {
2739 Register result = ToRegister(instr->result()); 2742 Register result = ToRegister(instr->result());
2740 __ movq(result, rsi); 2743 __ movq(result, rsi);
2741 } 2744 }
2742 2745
2743 2746
2744 void LCodeGen::DoOuterContext(LOuterContext* instr) { 2747 void LCodeGen::DoOuterContext(LOuterContext* instr) {
(...skipping 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after
4945 FixedArray::kHeaderSize - kPointerSize)); 4948 FixedArray::kHeaderSize - kPointerSize));
4946 __ bind(&done); 4949 __ bind(&done);
4947 } 4950 }
4948 4951
4949 4952
4950 #undef __ 4953 #undef __
4951 4954
4952 } } // namespace v8::internal 4955 } } // namespace v8::internal
4953 4956
4954 #endif // V8_TARGET_ARCH_X64 4957 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/deoptimizer-x64.cc ('k') | test/mjsunit/compiler/optimized-closures.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698