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

Side by Side Diff: src/objects.cc

Issue 1371893002: objects-inl.h: Remove ACCESSORS_TO_SMI macro (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: undo last_script_id storage change Created 5 years, 2 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/objects-debug.cc » ('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 "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 10902 matching lines...) Expand 10 before | Expand all | Expand 10 after
10913 DCHECK(script->line_ends()->IsFixedArray()); 10913 DCHECK(script->line_ends()->IsFixedArray());
10914 } 10914 }
10915 10915
10916 10916
10917 int Script::GetColumnNumber(Handle<Script> script, int code_pos) { 10917 int Script::GetColumnNumber(Handle<Script> script, int code_pos) {
10918 int line_number = GetLineNumber(script, code_pos); 10918 int line_number = GetLineNumber(script, code_pos);
10919 if (line_number == -1) return -1; 10919 if (line_number == -1) return -1;
10920 10920
10921 DisallowHeapAllocation no_allocation; 10921 DisallowHeapAllocation no_allocation;
10922 FixedArray* line_ends_array = FixedArray::cast(script->line_ends()); 10922 FixedArray* line_ends_array = FixedArray::cast(script->line_ends());
10923 line_number = line_number - script->line_offset()->value(); 10923 line_number = line_number - script->line_offset();
10924 if (line_number == 0) return code_pos + script->column_offset()->value(); 10924 if (line_number == 0) return code_pos + script->column_offset();
10925 int prev_line_end_pos = 10925 int prev_line_end_pos =
10926 Smi::cast(line_ends_array->get(line_number - 1))->value(); 10926 Smi::cast(line_ends_array->get(line_number - 1))->value();
10927 return code_pos - (prev_line_end_pos + 1); 10927 return code_pos - (prev_line_end_pos + 1);
10928 } 10928 }
10929 10929
10930 10930
10931 int Script::GetLineNumberWithArray(int code_pos) { 10931 int Script::GetLineNumberWithArray(int code_pos) {
10932 DisallowHeapAllocation no_allocation; 10932 DisallowHeapAllocation no_allocation;
10933 DCHECK(line_ends()->IsFixedArray()); 10933 DCHECK(line_ends()->IsFixedArray());
10934 FixedArray* line_ends_array = FixedArray::cast(line_ends()); 10934 FixedArray* line_ends_array = FixedArray::cast(line_ends());
10935 int line_ends_len = line_ends_array->length(); 10935 int line_ends_len = line_ends_array->length();
10936 if (line_ends_len == 0) return -1; 10936 if (line_ends_len == 0) return -1;
10937 10937
10938 if ((Smi::cast(line_ends_array->get(0)))->value() >= code_pos) { 10938 if ((Smi::cast(line_ends_array->get(0)))->value() >= code_pos) {
10939 return line_offset()->value(); 10939 return line_offset();
10940 } 10940 }
10941 10941
10942 int left = 0; 10942 int left = 0;
10943 int right = line_ends_len; 10943 int right = line_ends_len;
10944 while (int half = (right - left) / 2) { 10944 while (int half = (right - left) / 2) {
10945 if ((Smi::cast(line_ends_array->get(left + half)))->value() > code_pos) { 10945 if ((Smi::cast(line_ends_array->get(left + half)))->value() > code_pos) {
10946 right -= half; 10946 right -= half;
10947 } else { 10947 } else {
10948 left += half; 10948 left += half;
10949 } 10949 }
10950 } 10950 }
10951 return right + line_offset()->value(); 10951 return right + line_offset();
10952 } 10952 }
10953 10953
10954 10954
10955 int Script::GetLineNumber(Handle<Script> script, int code_pos) { 10955 int Script::GetLineNumber(Handle<Script> script, int code_pos) {
10956 InitLineEnds(script); 10956 InitLineEnds(script);
10957 return script->GetLineNumberWithArray(code_pos); 10957 return script->GetLineNumberWithArray(code_pos);
10958 } 10958 }
10959 10959
10960 10960
10961 int Script::GetLineNumber(int code_pos) { 10961 int Script::GetLineNumber(int code_pos) {
(...skipping 5210 matching lines...) Expand 10 before | Expand all | Expand 10 after
16172 for (int i = 0; i < old_break_points->length(); i++) { 16172 for (int i = 0; i < old_break_points->length(); i++) {
16173 new_break_points->set(i, old_break_points->get(i)); 16173 new_break_points->set(i, old_break_points->get(i));
16174 } 16174 }
16175 index = old_break_points->length(); 16175 index = old_break_points->length();
16176 } 16176 }
16177 DCHECK(index != kNoBreakPointInfo); 16177 DCHECK(index != kNoBreakPointInfo);
16178 16178
16179 // Allocate new BreakPointInfo object and set the break point. 16179 // Allocate new BreakPointInfo object and set the break point.
16180 Handle<BreakPointInfo> new_break_point_info = Handle<BreakPointInfo>::cast( 16180 Handle<BreakPointInfo> new_break_point_info = Handle<BreakPointInfo>::cast(
16181 isolate->factory()->NewStruct(BREAK_POINT_INFO_TYPE)); 16181 isolate->factory()->NewStruct(BREAK_POINT_INFO_TYPE));
16182 new_break_point_info->set_code_position(Smi::FromInt(code_position)); 16182 new_break_point_info->set_code_position(code_position);
16183 new_break_point_info->set_source_position(Smi::FromInt(source_position)); 16183 new_break_point_info->set_source_position(source_position);
16184 new_break_point_info-> 16184 new_break_point_info->set_statement_position(statement_position);
16185 set_statement_position(Smi::FromInt(statement_position));
16186 new_break_point_info->set_break_point_objects( 16185 new_break_point_info->set_break_point_objects(
16187 isolate->heap()->undefined_value()); 16186 isolate->heap()->undefined_value());
16188 BreakPointInfo::SetBreakPoint(new_break_point_info, break_point_object); 16187 BreakPointInfo::SetBreakPoint(new_break_point_info, break_point_object);
16189 debug_info->break_points()->set(index, *new_break_point_info); 16188 debug_info->break_points()->set(index, *new_break_point_info);
16190 } 16189 }
16191 16190
16192 16191
16193 // Get the break point objects for a code position. 16192 // Get the break point objects for a code position.
16194 Handle<Object> DebugInfo::GetBreakPointObjects(int code_position) { 16193 Handle<Object> DebugInfo::GetBreakPointObjects(int code_position) {
16195 Object* break_point_info = GetBreakPointInfo(code_position); 16194 Object* break_point_info = GetBreakPointInfo(code_position);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
16237 16236
16238 16237
16239 // Find the index of the break point info object for the specified code 16238 // Find the index of the break point info object for the specified code
16240 // position. 16239 // position.
16241 int DebugInfo::GetBreakPointInfoIndex(int code_position) { 16240 int DebugInfo::GetBreakPointInfoIndex(int code_position) {
16242 if (break_points()->IsUndefined()) return kNoBreakPointInfo; 16241 if (break_points()->IsUndefined()) return kNoBreakPointInfo;
16243 for (int i = 0; i < break_points()->length(); i++) { 16242 for (int i = 0; i < break_points()->length(); i++) {
16244 if (!break_points()->get(i)->IsUndefined()) { 16243 if (!break_points()->get(i)->IsUndefined()) {
16245 BreakPointInfo* break_point_info = 16244 BreakPointInfo* break_point_info =
16246 BreakPointInfo::cast(break_points()->get(i)); 16245 BreakPointInfo::cast(break_points()->get(i));
16247 if (break_point_info->code_position()->value() == code_position) { 16246 if (break_point_info->code_position() == code_position) {
16248 return i; 16247 return i;
16249 } 16248 }
16250 } 16249 }
16251 } 16250 }
16252 return kNoBreakPointInfo; 16251 return kNoBreakPointInfo;
16253 } 16252 }
16254 16253
16255 16254
16256 // Remove the specified break point object. 16255 // Remove the specified break point object.
16257 void BreakPointInfo::ClearBreakPoint(Handle<BreakPointInfo> break_point_info, 16256 void BreakPointInfo::ClearBreakPoint(Handle<BreakPointInfo> break_point_info,
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
16755 if (cell->value() != *new_value) { 16754 if (cell->value() != *new_value) {
16756 cell->set_value(*new_value); 16755 cell->set_value(*new_value);
16757 Isolate* isolate = cell->GetIsolate(); 16756 Isolate* isolate = cell->GetIsolate();
16758 cell->dependent_code()->DeoptimizeDependentCodeGroup( 16757 cell->dependent_code()->DeoptimizeDependentCodeGroup(
16759 isolate, DependentCode::kPropertyCellChangedGroup); 16758 isolate, DependentCode::kPropertyCellChangedGroup);
16760 } 16759 }
16761 } 16760 }
16762 16761
16763 } // namespace internal 16762 } // namespace internal
16764 } // namespace v8 16763 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698