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

Side by Side Diff: src/objects.cc

Issue 967323002: Refactor BreakLocationIterator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: static_cast instead Created 5 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
« no previous file with comments | « src/objects.h ('k') | src/ppc/assembler-ppc.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 <iomanip> 5 #include <iomanip>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 16708 matching lines...) Expand 10 before | Expand all | Expand 10 after
16719 new_break_point_info-> 16719 new_break_point_info->
16720 set_statement_position(Smi::FromInt(statement_position)); 16720 set_statement_position(Smi::FromInt(statement_position));
16721 new_break_point_info->set_break_point_objects( 16721 new_break_point_info->set_break_point_objects(
16722 isolate->heap()->undefined_value()); 16722 isolate->heap()->undefined_value());
16723 BreakPointInfo::SetBreakPoint(new_break_point_info, break_point_object); 16723 BreakPointInfo::SetBreakPoint(new_break_point_info, break_point_object);
16724 debug_info->break_points()->set(index, *new_break_point_info); 16724 debug_info->break_points()->set(index, *new_break_point_info);
16725 } 16725 }
16726 16726
16727 16727
16728 // Get the break point objects for a code position. 16728 // Get the break point objects for a code position.
16729 Object* DebugInfo::GetBreakPointObjects(int code_position) { 16729 Handle<Object> DebugInfo::GetBreakPointObjects(int code_position) {
16730 Object* break_point_info = GetBreakPointInfo(code_position); 16730 Object* break_point_info = GetBreakPointInfo(code_position);
16731 if (break_point_info->IsUndefined()) { 16731 if (break_point_info->IsUndefined()) {
16732 return GetHeap()->undefined_value(); 16732 return GetIsolate()->factory()->undefined_value();
16733 } 16733 }
16734 return BreakPointInfo::cast(break_point_info)->break_point_objects(); 16734 return Handle<Object>(
16735 BreakPointInfo::cast(break_point_info)->break_point_objects(),
16736 GetIsolate());
16735 } 16737 }
16736 16738
16737 16739
16738 // Get the total number of break points. 16740 // Get the total number of break points.
16739 int DebugInfo::GetBreakPointCount() { 16741 int DebugInfo::GetBreakPointCount() {
16740 if (break_points()->IsUndefined()) return 0; 16742 if (break_points()->IsUndefined()) return 0;
16741 int count = 0; 16743 int count = 0;
16742 for (int i = 0; i < break_points()->length(); i++) { 16744 for (int i = 0; i < break_points()->length(); i++) {
16743 if (!break_points()->get(i)->IsUndefined()) { 16745 if (!break_points()->get(i)->IsUndefined()) {
16744 BreakPointInfo* break_point_info = 16746 BreakPointInfo* break_point_info =
16745 BreakPointInfo::cast(break_points()->get(i)); 16747 BreakPointInfo::cast(break_points()->get(i));
16746 count += break_point_info->GetBreakPointCount(); 16748 count += break_point_info->GetBreakPointCount();
16747 } 16749 }
16748 } 16750 }
16749 return count; 16751 return count;
16750 } 16752 }
16751 16753
16752 16754
16753 Object* DebugInfo::FindBreakPointInfo(Handle<DebugInfo> debug_info, 16755 Handle<Object> DebugInfo::FindBreakPointInfo(
16754 Handle<Object> break_point_object) { 16756 Handle<DebugInfo> debug_info, Handle<Object> break_point_object) {
16755 Heap* heap = debug_info->GetHeap(); 16757 Isolate* isolate = debug_info->GetIsolate();
16756 if (debug_info->break_points()->IsUndefined()) return heap->undefined_value(); 16758 if (!debug_info->break_points()->IsUndefined()) {
16757 for (int i = 0; i < debug_info->break_points()->length(); i++) { 16759 for (int i = 0; i < debug_info->break_points()->length(); i++) {
16758 if (!debug_info->break_points()->get(i)->IsUndefined()) { 16760 if (!debug_info->break_points()->get(i)->IsUndefined()) {
16759 Handle<BreakPointInfo> break_point_info = 16761 Handle<BreakPointInfo> break_point_info = Handle<BreakPointInfo>(
16760 Handle<BreakPointInfo>(BreakPointInfo::cast( 16762 BreakPointInfo::cast(debug_info->break_points()->get(i)), isolate);
16761 debug_info->break_points()->get(i))); 16763 if (BreakPointInfo::HasBreakPointObject(break_point_info,
16762 if (BreakPointInfo::HasBreakPointObject(break_point_info, 16764 break_point_object)) {
16763 break_point_object)) { 16765 return break_point_info;
16764 return *break_point_info; 16766 }
16765 } 16767 }
16766 } 16768 }
16767 } 16769 }
16768 return heap->undefined_value(); 16770 return isolate->factory()->undefined_value();
16769 } 16771 }
16770 16772
16771 16773
16772 // Find the index of the break point info object for the specified code 16774 // Find the index of the break point info object for the specified code
16773 // position. 16775 // position.
16774 int DebugInfo::GetBreakPointInfoIndex(int code_position) { 16776 int DebugInfo::GetBreakPointInfoIndex(int code_position) {
16775 if (break_points()->IsUndefined()) return kNoBreakPointInfo; 16777 if (break_points()->IsUndefined()) return kNoBreakPointInfo;
16776 for (int i = 0; i < break_points()->length(); i++) { 16778 for (int i = 0; i < break_points()->length(); i++) {
16777 if (!break_points()->get(i)->IsUndefined()) { 16779 if (!break_points()->get(i)->IsUndefined()) {
16778 BreakPointInfo* break_point_info = 16780 BreakPointInfo* break_point_info =
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
17164 CompilationInfo* info) { 17166 CompilationInfo* info) {
17165 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( 17167 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo(
17166 handle(cell->dependent_code(), info->isolate()), 17168 handle(cell->dependent_code(), info->isolate()),
17167 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); 17169 DependentCode::kPropertyCellChangedGroup, info->object_wrapper());
17168 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 17170 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
17169 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 17171 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
17170 cell, info->zone()); 17172 cell, info->zone());
17171 } 17173 }
17172 17174
17173 } } // namespace v8::internal 17175 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/ppc/assembler-ppc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698