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

Side by Side Diff: src/debug/debug.cc

Issue 1783483002: [interpreter] Add support for scalable operands. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Operand renaming. Created 4 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/debug/debug.h" 5 #include "src/debug/debug.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 break; 215 break;
216 } 216 }
217 } 217 }
218 } 218 }
219 219
220 BreakLocation::DebugBreakType 220 BreakLocation::DebugBreakType
221 BreakLocation::BytecodeArrayIterator::GetDebugBreakType() { 221 BreakLocation::BytecodeArrayIterator::GetDebugBreakType() {
222 BytecodeArray* bytecode_array = debug_info_->original_bytecode_array(); 222 BytecodeArray* bytecode_array = debug_info_->original_bytecode_array();
223 interpreter::Bytecode bytecode = 223 interpreter::Bytecode bytecode =
224 interpreter::Bytecodes::FromByte(bytecode_array->get(code_offset())); 224 interpreter::Bytecodes::FromByte(bytecode_array->get(code_offset()));
225 if (interpreter::Bytecodes::GetPrefixBytecodeScale(bytecode) > 1) {
rmcilroy 2016/03/10 16:45:37 Could you pull out the logic for getting the curre
oth 2016/03/11 16:26:12 Done.
226 bytecode = interpreter::Bytecodes::FromByte(
227 bytecode_array->get(code_offset() + 1));
228 }
225 229
226 if (bytecode == interpreter::Bytecode::kDebugger) { 230 if (bytecode == interpreter::Bytecode::kDebugger) {
227 return DEBUGGER_STATEMENT; 231 return DEBUGGER_STATEMENT;
228 } else if (bytecode == interpreter::Bytecode::kReturn) { 232 } else if (bytecode == interpreter::Bytecode::kReturn) {
229 return DEBUG_BREAK_SLOT_AT_RETURN; 233 return DEBUG_BREAK_SLOT_AT_RETURN;
230 } else if (interpreter::Bytecodes::IsCallOrNew(bytecode)) { 234 } else if (interpreter::Bytecodes::IsCallOrNew(bytecode)) {
231 return DEBUG_BREAK_SLOT_AT_CALL; 235 return DEBUG_BREAK_SLOT_AT_CALL;
232 } else if (source_position_iterator_.is_statement()) { 236 } else if (source_position_iterator_.is_statement()) {
233 return DEBUG_BREAK_SLOT; 237 return DEBUG_BREAK_SLOT;
234 } else { 238 } else {
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 DCHECK(code->kind() == Code::FUNCTION); 418 DCHECK(code->kind() == Code::FUNCTION);
415 Builtins* builtins = isolate()->builtins(); 419 Builtins* builtins = isolate()->builtins();
416 Handle<Code> target = IsReturn() ? builtins->Return_DebugBreak() 420 Handle<Code> target = IsReturn() ? builtins->Return_DebugBreak()
417 : builtins->Slot_DebugBreak(); 421 : builtins->Slot_DebugBreak();
418 Address pc = code->instruction_start() + code_offset(); 422 Address pc = code->instruction_start() + code_offset();
419 DebugCodegen::PatchDebugBreakSlot(isolate(), pc, target); 423 DebugCodegen::PatchDebugBreakSlot(isolate(), pc, target);
420 } else { 424 } else {
421 BytecodeArray* bytecode_array = abstract_code()->GetBytecodeArray(); 425 BytecodeArray* bytecode_array = abstract_code()->GetBytecodeArray();
422 interpreter::Bytecode bytecode = 426 interpreter::Bytecode bytecode =
423 interpreter::Bytecodes::FromByte(bytecode_array->get(code_offset())); 427 interpreter::Bytecodes::FromByte(bytecode_array->get(code_offset()));
428 int prefix_offset = 0;
429 int operand_scale =
430 interpreter::Bytecodes::GetPrefixBytecodeScale(bytecode);
431 if (operand_scale > 1) {
432 prefix_offset = 1;
433 bytecode = interpreter::Bytecodes::FromByte(
434 bytecode_array->get(code_offset() + prefix_offset));
435 }
424 interpreter::Bytecode debugbreak = 436 interpreter::Bytecode debugbreak =
425 interpreter::Bytecodes::GetDebugBreak(bytecode); 437 interpreter::Bytecodes::GetDebugBreak(bytecode, operand_scale);
426 bytecode_array->set(code_offset(), 438 bytecode_array->set(code_offset() + prefix_offset,
427 interpreter::Bytecodes::ToByte(debugbreak)); 439 interpreter::Bytecodes::ToByte(debugbreak));
428 } 440 }
429 DCHECK(IsDebugBreak()); 441 DCHECK(IsDebugBreak());
430 } 442 }
431 443
432 444
433 void BreakLocation::ClearDebugBreak() { 445 void BreakLocation::ClearDebugBreak() {
434 // Debugger statement always calls debugger. No need to modify it. 446 // Debugger statement always calls debugger. No need to modify it.
435 if (IsDebuggerStatement()) return; 447 if (IsDebuggerStatement()) return;
436 448
437 DCHECK(IsDebugBreakSlot()); 449 DCHECK(IsDebugBreakSlot());
438 if (abstract_code()->IsCode()) { 450 if (abstract_code()->IsCode()) {
439 Code* code = abstract_code()->GetCode(); 451 Code* code = abstract_code()->GetCode();
440 DCHECK(code->kind() == Code::FUNCTION); 452 DCHECK(code->kind() == Code::FUNCTION);
441 Address pc = code->instruction_start() + code_offset(); 453 Address pc = code->instruction_start() + code_offset();
442 DebugCodegen::ClearDebugBreakSlot(isolate(), pc); 454 DebugCodegen::ClearDebugBreakSlot(isolate(), pc);
443 } else { 455 } else {
444 BytecodeArray* bytecode_array = abstract_code()->GetBytecodeArray(); 456 BytecodeArray* bytecode_array = abstract_code()->GetBytecodeArray();
445 BytecodeArray* original = debug_info_->original_bytecode_array(); 457 BytecodeArray* original = debug_info_->original_bytecode_array();
446 bytecode_array->set(code_offset(), original->get(code_offset())); 458 int operand_scale = interpreter::Bytecodes::GetPrefixBytecodeScale(
459 interpreter::Bytecodes::FromByte(original->get(code_offset())));
460 int prefix_offset = operand_scale > 1 ? 1 : 0;
461 bytecode_array->set(code_offset() + prefix_offset,
462 original->get(code_offset() + prefix_offset));
447 } 463 }
448 DCHECK(!IsDebugBreak()); 464 DCHECK(!IsDebugBreak());
449 } 465 }
450 466
451 467
452 bool BreakLocation::IsDebugBreak() const { 468 bool BreakLocation::IsDebugBreak() const {
453 if (IsDebuggerStatement()) return false; 469 if (IsDebuggerStatement()) return false;
454 DCHECK(IsDebugBreakSlot()); 470 DCHECK(IsDebugBreakSlot());
455 if (abstract_code()->IsCode()) { 471 if (abstract_code()->IsCode()) {
456 Code* code = abstract_code()->GetCode(); 472 Code* code = abstract_code()->GetCode();
457 DCHECK(code->kind() == Code::FUNCTION); 473 DCHECK(code->kind() == Code::FUNCTION);
458 Address pc = code->instruction_start() + code_offset(); 474 Address pc = code->instruction_start() + code_offset();
459 return DebugCodegen::DebugBreakSlotIsPatched(pc); 475 return DebugCodegen::DebugBreakSlotIsPatched(pc);
460 } else { 476 } else {
461 BytecodeArray* bytecode_array = abstract_code()->GetBytecodeArray(); 477 BytecodeArray* bytecode_array = abstract_code()->GetBytecodeArray();
462 interpreter::Bytecode bytecode = 478 interpreter::Bytecode bytecode =
463 interpreter::Bytecodes::FromByte(bytecode_array->get(code_offset())); 479 interpreter::Bytecodes::FromByte(bytecode_array->get(code_offset()));
480 if (interpreter::Bytecodes::GetPrefixBytecodeScale(bytecode) > 1) {
481 bytecode = interpreter::Bytecodes::FromByte(
482 bytecode_array->get(code_offset()) + 1);
483 }
464 return interpreter::Bytecodes::IsDebugBreak(bytecode); 484 return interpreter::Bytecodes::IsDebugBreak(bytecode);
465 } 485 }
466 } 486 }
467 487
468 488
469 Handle<Object> BreakLocation::BreakPointObjects() const { 489 Handle<Object> BreakLocation::BreakPointObjects() const {
470 return debug_info_->GetBreakPointObjects(code_offset_); 490 return debug_info_->GetBreakPointObjects(code_offset_);
471 } 491 }
472 492
473 void DebugFeatureTracker::Track(DebugFeatureTracker::Feature feature) { 493 void DebugFeatureTracker::Track(DebugFeatureTracker::Feature feature) {
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 Object* Debug::SetAfterBreakTarget(JavaScriptFrame* frame) { 1606 Object* Debug::SetAfterBreakTarget(JavaScriptFrame* frame) {
1587 if (frame->is_interpreted()) { 1607 if (frame->is_interpreted()) {
1588 // Find the handler from the original bytecode array. 1608 // Find the handler from the original bytecode array.
1589 InterpretedFrame* interpreted_frame = 1609 InterpretedFrame* interpreted_frame =
1590 reinterpret_cast<InterpretedFrame*>(frame); 1610 reinterpret_cast<InterpretedFrame*>(frame);
1591 SharedFunctionInfo* shared = interpreted_frame->function()->shared(); 1611 SharedFunctionInfo* shared = interpreted_frame->function()->shared();
1592 BytecodeArray* bytecode_array = shared->bytecode_array(); 1612 BytecodeArray* bytecode_array = shared->bytecode_array();
1593 int bytecode_offset = interpreted_frame->GetBytecodeOffset(); 1613 int bytecode_offset = interpreted_frame->GetBytecodeOffset();
1594 interpreter::Bytecode bytecode = 1614 interpreter::Bytecode bytecode =
1595 interpreter::Bytecodes::FromByte(bytecode_array->get(bytecode_offset)); 1615 interpreter::Bytecodes::FromByte(bytecode_array->get(bytecode_offset));
1596 return isolate_->interpreter()->GetBytecodeHandler(bytecode); 1616 int operand_scale =
1617 interpreter::Bytecodes::GetPrefixBytecodeScale(bytecode);
1618 if (operand_scale > 1) {
1619 interpreter::Bytecodes::FromByte(
1620 bytecode_array->get(bytecode_offset + 1));
1621 }
1622 return isolate_->interpreter()->GetBytecodeHandler(bytecode, operand_scale);
1597 } else { 1623 } else {
1598 after_break_target_ = NULL; 1624 after_break_target_ = NULL;
1599 if (!LiveEdit::SetAfterBreakTarget(this)) { 1625 if (!LiveEdit::SetAfterBreakTarget(this)) {
1600 // Continue just after the slot. 1626 // Continue just after the slot.
1601 after_break_target_ = frame->pc(); 1627 after_break_target_ = frame->pc();
1602 } 1628 }
1603 return isolate_->heap()->undefined_value(); 1629 return isolate_->heap()->undefined_value();
1604 } 1630 }
1605 } 1631 }
1606 1632
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
2673 } 2699 }
2674 2700
2675 2701
2676 void LockingCommandMessageQueue::Clear() { 2702 void LockingCommandMessageQueue::Clear() {
2677 base::LockGuard<base::Mutex> lock_guard(&mutex_); 2703 base::LockGuard<base::Mutex> lock_guard(&mutex_);
2678 queue_.Clear(); 2704 queue_.Clear();
2679 } 2705 }
2680 2706
2681 } // namespace internal 2707 } // namespace internal
2682 } // namespace v8 2708 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698