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

Side by Side Diff: src/x64/deoptimizer-x64.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/x64/code-stubs-x64.cc ('k') | test/mjsunit/fuzz-natives-part1.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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 output_frame->SetPc(pc_value); 447 output_frame->SetPc(pc_value);
448 } 448 }
449 449
450 450
451 void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator, 451 void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator,
452 int frame_index) { 452 int frame_index) {
453 // 453 //
454 // FROM TO <-rbp 454 // FROM TO <-rbp
455 // | .... | | .... | 455 // | .... | | .... |
456 // +-------------------------+ +-------------------------+ 456 // +-------------------------+ +-------------------------+
457 // | JSFunction continuation | | JSFunction continuation | 457 // | JSFunction continuation | | parameter 1 |
458 // +-------------------------+ +-------------------------+
459 // | | saved frame (rbp) | | .... |
460 // | +=========================+<-rbp +-------------------------+
461 // | | JSFunction context | | parameter n |
462 // v +-------------------------+ +-------------------------|
463 // | COMPILED_STUB marker | | JSFunction continuation |
458 // +-------------------------+ +-------------------------+<-rsp 464 // +-------------------------+ +-------------------------+<-rsp
459 // | | saved frame (rbp) | 465 // | | rax = number of parameters
460 // | +=========================+<-rbp 466 // | ... | rbx = failure handler address
461 // | | JSFunction context | 467 // | | rbp = saved frame
462 // v +-------------------------+ 468 // +-------------------------+<-rsp rsi = JSFunction context
463 // | COMPILED_STUB marker | rbp = saved frame
464 // +-------------------------+ rsi = JSFunction context
465 // | |
466 // | ... |
467 // | |
468 // +-------------------------+<-rsp
469 // 469 //
470 // 470 //
471 int output_frame_size = 1 * kPointerSize;
472 FrameDescription* output_frame =
473 new(output_frame_size) FrameDescription(output_frame_size, 0);
474 Code* notify_miss =
475 isolate_->builtins()->builtin(Builtins::kNotifyICMiss);
476 output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS));
477 output_frame->SetContinuation(
478 reinterpret_cast<intptr_t>(notify_miss->entry()));
479 471
480 ASSERT(compiled_code_->kind() == Code::COMPILED_STUB); 472 ASSERT(compiled_code_->kind() == Code::COMPILED_STUB);
481 int major_key = compiled_code_->major_key(); 473 int major_key = compiled_code_->major_key();
482 CodeStubInterfaceDescriptor* descriptor = 474 CodeStubInterfaceDescriptor* descriptor =
483 isolate_->code_stub_interface_descriptor(major_key); 475 isolate_->code_stub_interface_descriptor(major_key);
484 Handle<Code> miss_ic(descriptor->deoptimization_handler_); 476
485 output_frame->SetPc(reinterpret_cast<intptr_t>(miss_ic->instruction_start())); 477 int output_frame_size =
478 (1 + descriptor->register_param_count_) * kPointerSize;
479 FrameDescription* output_frame =
480 new(output_frame_size) FrameDescription(output_frame_size, 0);
481 Code* notify_failure =
482 isolate_->builtins()->builtin(Builtins::kNotifyStubFailure);
483 output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS));
484 output_frame->SetContinuation(
485 reinterpret_cast<intptr_t>(notify_failure->entry()));
486
487 Code* code;
488 CEntryStub(1, kDontSaveFPRegs).FindCodeInCache(&code, isolate_);
489 output_frame->SetPc(reinterpret_cast<intptr_t>(code->instruction_start()));
486 unsigned input_frame_size = input_->GetFrameSize(); 490 unsigned input_frame_size = input_->GetFrameSize();
487 intptr_t value = input_->GetFrameSlot(input_frame_size - kPointerSize); 491 intptr_t value = input_->GetFrameSlot(input_frame_size - kPointerSize);
488 output_frame->SetFrameSlot(0, value); 492 output_frame->SetFrameSlot(0, value);
489 value = input_->GetFrameSlot(input_frame_size - 2 * kPointerSize); 493 value = input_->GetFrameSlot(input_frame_size - 2 * kPointerSize);
490 output_frame->SetRegister(rbp.code(), value); 494 output_frame->SetRegister(rbp.code(), value);
491 output_frame->SetFp(value); 495 output_frame->SetFp(value);
492 value = input_->GetFrameSlot(input_frame_size - 3 * kPointerSize); 496 value = input_->GetFrameSlot(input_frame_size - 3 * kPointerSize);
493 output_frame->SetRegister(rsi.code(), value); 497 output_frame->SetRegister(rsi.code(), value);
494 498
495 Translation::Opcode opcode = 499 int parameter_offset = kPointerSize * descriptor->register_param_count_;
496 static_cast<Translation::Opcode>(iterator->Next()); 500 for (int i = 0; i < descriptor->register_param_count_; ++i) {
497 ASSERT(opcode == Translation::REGISTER); 501 Translation::Opcode opcode =
498 USE(opcode); 502 static_cast<Translation::Opcode>(iterator->Next());
499 int input_reg = iterator->Next(); 503 ASSERT(opcode == Translation::REGISTER);
500 intptr_t input_value = input_->GetRegister(input_reg); 504 USE(opcode);
501 output_frame->SetRegister(rdx.code(), input_value); 505 int input_reg = iterator->Next();
506 intptr_t reg_value = input_->GetRegister(input_reg);
507 output_frame->SetFrameSlot(parameter_offset, reg_value);
508 parameter_offset -= kPointerSize;
509 }
502 510
503 int32_t next = iterator->Next(); 511 intptr_t handler =
504 opcode = static_cast<Translation::Opcode>(next); 512 reinterpret_cast<intptr_t>(descriptor->deoptimization_handler_);
505 ASSERT(opcode == Translation::REGISTER); 513 output_frame->SetRegister(rax.code(), descriptor->register_param_count_);
506 input_reg = iterator->Next(); 514 output_frame->SetRegister(rbx.code(), handler);
507 input_value = input_->GetRegister(input_reg);
508 output_frame->SetRegister(rax.code(), input_value);
509 515
510 ASSERT(frame_index == 0); 516 ASSERT(frame_index == 0);
511 output_[frame_index] = output_frame; 517 output_[frame_index] = output_frame;
512 } 518 }
513 519
514 520
515 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, 521 void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
516 int frame_index) { 522 int frame_index) {
517 Builtins* builtins = isolate_->builtins(); 523 Builtins* builtins = isolate_->builtins();
518 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric); 524 Code* construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric);
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 } 1172 }
1167 __ bind(&done); 1173 __ bind(&done);
1168 } 1174 }
1169 1175
1170 #undef __ 1176 #undef __
1171 1177
1172 1178
1173 } } // namespace v8::internal 1179 } } // namespace v8::internal
1174 1180
1175 #endif // V8_TARGET_ARCH_X64 1181 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | test/mjsunit/fuzz-natives-part1.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698