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

Side by Side Diff: src/arm/deoptimizer-arm.cc

Issue 11635015: Generalize calling to C++ on stub deopt (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixes Created 7 years, 11 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/code-stubs-arm.cc ('k') | src/builtins.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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 output_frame->SetPc(pc); 451 output_frame->SetPc(pc);
452 } 452 }
453 453
454 454
455 void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator, 455 void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator,
456 int frame_index) { 456 int frame_index) {
457 // 457 //
458 // FROM TO <-fp 458 // FROM TO <-fp
459 // | .... | | .... | 459 // | .... | | .... |
460 // +-------------------------+ +-------------------------+ 460 // +-------------------------+ +-------------------------+
461 // | JSFunction continuation | | JSFunction continuation | 461 // | JSFunction continuation | | parameter 1 |
462 // +-------------------------+ +-------------------------+
463 // | | saved frame (fp) | | .... |
464 // | +=========================+<-fp +-------------------------+
465 // | | JSFunction context | | parameter n |
466 // v +-------------------------+ +-------------------------|
467 // | COMPILED_STUB marker | | JSFunction continuation |
462 // +-------------------------+ +-------------------------+<-sp 468 // +-------------------------+ +-------------------------+<-sp
463 // | | saved frame (fp) | 469 // | | r0 = number of parameters
464 // | +=========================+<-fp 470 // | ... | r1 = failure handler address
465 // | | JSFunction context | 471 // | | fp = saved frame
466 // v +-------------------------+ 472 // +-------------------------+<-sp cp = JSFunction context
467 // | COMPILED_STUB marker | fp = saved frame
468 // +-------------------------+ f8 = JSFunction context
469 // | |
470 // | ... |
471 // | |
472 // +-------------------------+<-sp
473 // 473 //
474 // 474 //
475 int output_frame_size = 1 * kPointerSize;
476 FrameDescription* output_frame =
477 new(output_frame_size) FrameDescription(output_frame_size, 0);
478 Code* notify_miss =
479 isolate_->builtins()->builtin(Builtins::kNotifyICMiss);
480 output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS));
481 output_frame->SetContinuation(
482 reinterpret_cast<intptr_t>(notify_miss->entry()));
483 475
484 ASSERT(compiled_code_->kind() == Code::COMPILED_STUB); 476 ASSERT(compiled_code_->kind() == Code::COMPILED_STUB);
485 int major_key = compiled_code_->major_key(); 477 int major_key = compiled_code_->major_key();
486 CodeStubInterfaceDescriptor* descriptor = 478 CodeStubInterfaceDescriptor* descriptor =
487 isolate_->code_stub_interface_descriptor(major_key); 479 isolate_->code_stub_interface_descriptor(major_key);
488 Handle<Code> miss_ic(descriptor->deoptimization_handler_); 480
489 output_frame->SetPc(reinterpret_cast<intptr_t>(miss_ic->instruction_start())); 481 int output_frame_size =
482 (1 + descriptor->register_param_count_) * kPointerSize;
483 FrameDescription* output_frame =
484 new(output_frame_size) FrameDescription(output_frame_size, 0);
485 Code* notify_failure =
486 isolate_->builtins()->builtin(Builtins::kNotifyStubFailure);
487 output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS));
488 output_frame->SetContinuation(
489 reinterpret_cast<uint32_t>(notify_failure->entry()));
490
491 Code* code;
492 CEntryStub(1, kSaveFPRegs).FindCodeInCache(&code, isolate_);
493 output_frame->SetPc(reinterpret_cast<intptr_t>(code->instruction_start()));
490 unsigned input_frame_size = input_->GetFrameSize(); 494 unsigned input_frame_size = input_->GetFrameSize();
491 intptr_t value = input_->GetFrameSlot(input_frame_size - kPointerSize); 495 intptr_t value = input_->GetFrameSlot(input_frame_size - kPointerSize);
492 output_frame->SetFrameSlot(0, value); 496 output_frame->SetFrameSlot(0, value);
493 value = input_->GetFrameSlot(input_frame_size - 2 * kPointerSize); 497 value = input_->GetFrameSlot(input_frame_size - 2 * kPointerSize);
494 output_frame->SetRegister(fp.code(), value); 498 output_frame->SetRegister(fp.code(), value);
495 output_frame->SetFp(value); 499 output_frame->SetFp(value);
496 value = input_->GetFrameSlot(input_frame_size - 3 * kPointerSize); 500 value = input_->GetFrameSlot(input_frame_size - 3 * kPointerSize);
497 output_frame->SetRegister(cp.code(), value); 501 output_frame->SetRegister(cp.code(), value);
498 502
499 Translation::Opcode opcode = 503 int parameter_offset = kPointerSize * descriptor->register_param_count_;
500 static_cast<Translation::Opcode>(iterator->Next()); 504 for (int i = 0; i < descriptor->register_param_count_; ++i) {
501 ASSERT(opcode == Translation::REGISTER); 505 Translation::Opcode opcode =
502 USE(opcode); 506 static_cast<Translation::Opcode>(iterator->Next());
503 int input_reg = iterator->Next(); 507 ASSERT(opcode == Translation::REGISTER);
504 intptr_t input_value = input_->GetRegister(input_reg); 508 USE(opcode);
505 output_frame->SetRegister(r1.code(), input_value); 509 int input_reg = iterator->Next();
510 intptr_t reg_value = input_->GetRegister(input_reg);
511 output_frame->SetFrameSlot(parameter_offset, reg_value);
512 parameter_offset -= kPointerSize;
513 }
506 514
507 int32_t next = iterator->Next(); 515 ApiFunction function(descriptor->deoptimization_handler_);
508 opcode = static_cast<Translation::Opcode>(next); 516 ExternalReference xref(&function, ExternalReference::BUILTIN_CALL, isolate_);
509 ASSERT(opcode == Translation::REGISTER); 517 intptr_t handler = reinterpret_cast<intptr_t>(xref.address());
510 input_reg = iterator->Next(); 518 output_frame->SetRegister(r0.code(), descriptor->register_param_count_);
511 input_value = input_->GetRegister(input_reg); 519 output_frame->SetRegister(r1.code(), handler);
512 output_frame->SetRegister(r0.code(), input_value);
513 520
514 ASSERT(frame_index == 0); 521 ASSERT(frame_index == 0);
515 output_[frame_index] = output_frame; 522 output_[frame_index] = output_frame;
516 } 523 }
517 524
518 525
519 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, 526 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
520 int frame_index) { 527 int frame_index) {
521 Builtins* builtins = isolate_->builtins(); 528 Builtins* builtins = isolate_->builtins();
522 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric); 529 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric);
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 __ push(ip); 1188 __ push(ip);
1182 __ b(&done); 1189 __ b(&done);
1183 ASSERT(masm()->pc_offset() - start == table_entry_size_); 1190 ASSERT(masm()->pc_offset() - start == table_entry_size_);
1184 } 1191 }
1185 __ bind(&done); 1192 __ bind(&done);
1186 } 1193 }
1187 1194
1188 #undef __ 1195 #undef __
1189 1196
1190 } } // namespace v8::internal 1197 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698