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

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

Issue 9304001: Implement inlining of constructor calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed moar comments by Vyacheslav Egorov. Created 8 years, 9 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/arm/lithium-codegen-arm.h ('k') | src/ast.h » ('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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 Translation* translation) { 472 Translation* translation) {
473 if (environment == NULL) return; 473 if (environment == NULL) return;
474 474
475 // The translation includes one command per value in the environment. 475 // The translation includes one command per value in the environment.
476 int translation_size = environment->values()->length(); 476 int translation_size = environment->values()->length();
477 // The output frame height does not include the parameters. 477 // The output frame height does not include the parameters.
478 int height = translation_size - environment->parameter_count(); 478 int height = translation_size - environment->parameter_count();
479 479
480 WriteTranslation(environment->outer(), translation); 480 WriteTranslation(environment->outer(), translation);
481 int closure_id = DefineDeoptimizationLiteral(environment->closure()); 481 int closure_id = DefineDeoptimizationLiteral(environment->closure());
482 if (environment->is_arguments_adaptor()) { 482 switch (environment->frame_type()) {
483 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); 483 case JS_FUNCTION:
484 } else { 484 translation->BeginJSFrame(environment->ast_id(), closure_id, height);
485 translation->BeginJSFrame(environment->ast_id(), closure_id, height); 485 break;
486 case JS_CONSTRUCT:
487 translation->BeginConstructStubFrame(closure_id, translation_size);
488 break;
489 case ARGUMENTS_ADAPTOR:
490 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size);
491 break;
492 default:
493 UNREACHABLE();
486 } 494 }
487 for (int i = 0; i < translation_size; ++i) { 495 for (int i = 0; i < translation_size; ++i) {
488 LOperand* value = environment->values()->at(i); 496 LOperand* value = environment->values()->at(i);
489 // spilled_registers_ and spilled_double_registers_ are either 497 // spilled_registers_ and spilled_double_registers_ are either
490 // both NULL or both set. 498 // both NULL or both set.
491 if (environment->spilled_registers() != NULL && value != NULL) { 499 if (environment->spilled_registers() != NULL && value != NULL) {
492 if (value->IsRegister() && 500 if (value->IsRegister() &&
493 environment->spilled_registers()[value->index()] != NULL) { 501 environment->spilled_registers()[value->index()] != NULL) {
494 translation->MarkDuplicate(); 502 translation->MarkDuplicate();
495 AddToTranslation(translation, 503 AddToTranslation(translation,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 620
613 // Layout of the translation: 621 // Layout of the translation:
614 // 0 ........................................................ size - 1 + 4 622 // 0 ........................................................ size - 1 + 4
615 // [expression stack including arguments] [locals] [4 words] [parameters] 623 // [expression stack including arguments] [locals] [4 words] [parameters]
616 // |>------------ translation_size ------------<| 624 // |>------------ translation_size ------------<|
617 625
618 int frame_count = 0; 626 int frame_count = 0;
619 int jsframe_count = 0; 627 int jsframe_count = 0;
620 for (LEnvironment* e = environment; e != NULL; e = e->outer()) { 628 for (LEnvironment* e = environment; e != NULL; e = e->outer()) {
621 ++frame_count; 629 ++frame_count;
622 if (!e->is_arguments_adaptor()) { 630 if (e->frame_type() == JS_FUNCTION) {
623 ++jsframe_count; 631 ++jsframe_count;
624 } 632 }
625 } 633 }
626 Translation translation(&translations_, frame_count, jsframe_count); 634 Translation translation(&translations_, frame_count, jsframe_count);
627 WriteTranslation(environment, &translation); 635 WriteTranslation(environment, &translation);
628 int deoptimization_index = deoptimizations_.length(); 636 int deoptimization_index = deoptimizations_.length();
629 int pc_offset = masm()->pc_offset(); 637 int pc_offset = masm()->pc_offset();
630 environment->Register(deoptimization_index, 638 environment->Register(deoptimization_index,
631 translation.index(), 639 translation.index(),
632 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); 640 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1);
(...skipping 3674 matching lines...) Expand 10 before | Expand all | Expand 10 after
4307 } 4315 }
4308 4316
4309 // Check the holder map. 4317 // Check the holder map.
4310 DoCheckMapCommon(temp1, temp2, 4318 DoCheckMapCommon(temp1, temp2,
4311 Handle<Map>(current_prototype->map()), 4319 Handle<Map>(current_prototype->map()),
4312 ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment()); 4320 ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment());
4313 DeoptimizeIf(ne, instr->environment()); 4321 DeoptimizeIf(ne, instr->environment());
4314 } 4322 }
4315 4323
4316 4324
4325 void LCodeGen::DoAllocateObject(LAllocateObject* instr) {
4326 class DeferredAllocateObject: public LDeferredCode {
4327 public:
4328 DeferredAllocateObject(LCodeGen* codegen, LAllocateObject* instr)
4329 : LDeferredCode(codegen), instr_(instr) { }
4330 virtual void Generate() { codegen()->DoDeferredAllocateObject(instr_); }
4331 virtual LInstruction* instr() { return instr_; }
4332 private:
4333 LAllocateObject* instr_;
4334 };
4335
4336 DeferredAllocateObject* deferred = new DeferredAllocateObject(this, instr);
4337
4338 // TODO(mstarzinger): Implement inlined version instead of jumping to
4339 // deferred runtime call.
4340 __ jmp(deferred->entry());
4341
4342 __ bind(deferred->exit());
4343 }
4344
4345
4346 void LCodeGen::DoDeferredAllocateObject(LAllocateObject* instr) {
4347 Register result = ToRegister(instr->result());
4348 Handle<JSFunction> constructor = instr->hydrogen()->constructor();
4349
4350 // TODO(3095996): Get rid of this. For now, we need to make the
4351 // result register contain a valid pointer because it is already
4352 // contained in the register pointer map.
4353 __ mov(result, Operand(0));
4354
4355 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters);
4356 __ LoadHeapObject(r0, constructor);
4357 __ push(r0);
4358 CallRuntimeFromDeferred(Runtime::kNewObject, 1, instr);
4359 __ StoreToSafepointRegisterSlot(r0, result);
4360 }
4361
4362
4317 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { 4363 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) {
4318 Heap* heap = isolate()->heap(); 4364 Heap* heap = isolate()->heap();
4319 ElementsKind boilerplate_elements_kind = 4365 ElementsKind boilerplate_elements_kind =
4320 instr->hydrogen()->boilerplate_elements_kind(); 4366 instr->hydrogen()->boilerplate_elements_kind();
4321 4367
4322 // Deopt if the array literal boilerplate ElementsKind is of a type different 4368 // Deopt if the array literal boilerplate ElementsKind is of a type different
4323 // than the expected one. The check isn't necessary if the boilerplate has 4369 // than the expected one. The check isn't necessary if the boilerplate has
4324 // already been converted to FAST_ELEMENTS. 4370 // already been converted to FAST_ELEMENTS.
4325 if (boilerplate_elements_kind != FAST_ELEMENTS) { 4371 if (boilerplate_elements_kind != FAST_ELEMENTS) {
4326 __ LoadHeapObject(r1, instr->hydrogen()->boilerplate_object()); 4372 __ LoadHeapObject(r1, instr->hydrogen()->boilerplate_object());
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
4799 ASSERT(osr_pc_offset_ == -1); 4845 ASSERT(osr_pc_offset_ == -1);
4800 osr_pc_offset_ = masm()->pc_offset(); 4846 osr_pc_offset_ = masm()->pc_offset();
4801 } 4847 }
4802 4848
4803 4849
4804 4850
4805 4851
4806 #undef __ 4852 #undef __
4807 4853
4808 } } // namespace v8::internal 4854 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | src/ast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698