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

Side by Side Diff: src/handles.cc

Issue 18509003: Keep two empty lines between declarations for cpp files (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 years, 5 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/global-handles.cc ('k') | src/heap.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 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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 while (int half = (right - left) / 2) { 492 while (int half = (right - left) / 2) {
493 if ((Smi::cast(line_ends_array->get(left + half)))->value() > code_pos) { 493 if ((Smi::cast(line_ends_array->get(left + half)))->value() > code_pos) {
494 right -= half; 494 right -= half;
495 } else { 495 } else {
496 left += half; 496 left += half;
497 } 497 }
498 } 498 }
499 return right + script->line_offset()->value(); 499 return right + script->line_offset()->value();
500 } 500 }
501 501
502
502 // Convert code position into column number. 503 // Convert code position into column number.
503 int GetScriptColumnNumber(Handle<Script> script, int code_pos) { 504 int GetScriptColumnNumber(Handle<Script> script, int code_pos) {
504 int line_number = GetScriptLineNumber(script, code_pos); 505 int line_number = GetScriptLineNumber(script, code_pos);
505 if (line_number == -1) return -1; 506 if (line_number == -1) return -1;
506 507
507 DisallowHeapAllocation no_allocation; 508 DisallowHeapAllocation no_allocation;
508 FixedArray* line_ends_array = FixedArray::cast(script->line_ends()); 509 FixedArray* line_ends_array = FixedArray::cast(script->line_ends());
509 line_number = line_number - script->line_offset()->value(); 510 line_number = line_number - script->line_offset()->value();
510 if (line_number == 0) return code_pos + script->column_offset()->value(); 511 if (line_number == 0) return code_pos + script->column_offset()->value();
511 int prev_line_end_pos = 512 int prev_line_end_pos =
512 Smi::cast(line_ends_array->get(line_number - 1))->value(); 513 Smi::cast(line_ends_array->get(line_number - 1))->value();
513 return code_pos - (prev_line_end_pos + 1); 514 return code_pos - (prev_line_end_pos + 1);
514 } 515 }
515 516
517
516 int GetScriptLineNumberSafe(Handle<Script> script, int code_pos) { 518 int GetScriptLineNumberSafe(Handle<Script> script, int code_pos) {
517 DisallowHeapAllocation no_allocation; 519 DisallowHeapAllocation no_allocation;
518 if (!script->line_ends()->IsUndefined()) { 520 if (!script->line_ends()->IsUndefined()) {
519 return GetScriptLineNumber(script, code_pos); 521 return GetScriptLineNumber(script, code_pos);
520 } 522 }
521 // Slow mode: we do not have line_ends. We have to iterate through source. 523 // Slow mode: we do not have line_ends. We have to iterate through source.
522 if (!script->source()->IsString()) { 524 if (!script->source()->IsString()) {
523 return -1; 525 return -1;
524 } 526 }
525 String* source = String::cast(script->source()); 527 String* source = String::cast(script->source());
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 data->next = prev_next_; 911 data->next = prev_next_;
910 data->limit = prev_limit_; 912 data->limit = prev_limit_;
911 #ifdef DEBUG 913 #ifdef DEBUG
912 handles_detached_ = true; 914 handles_detached_ = true;
913 #endif 915 #endif
914 return deferred; 916 return deferred;
915 } 917 }
916 918
917 919
918 } } // namespace v8::internal 920 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/global-handles.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698