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

Side by Side Diff: src/handles.cc

Issue 7709024: Replace ToAsciiVector and ToUC16Vector with single function that returns a tagged value. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Require AssertNoAllocation. Fixed bug detected by this requirement. Created 9 years, 4 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 | « no previous file | src/hydrogen-instructions.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 bool with_last_line) { 610 bool with_last_line) {
611 src = FlattenGetString(src); 611 src = FlattenGetString(src);
612 // Rough estimate of line count based on a roughly estimated average 612 // Rough estimate of line count based on a roughly estimated average
613 // length of (unpacked) code. 613 // length of (unpacked) code.
614 int line_count_estimate = src->length() >> 4; 614 int line_count_estimate = src->length() >> 4;
615 List<int> line_ends(line_count_estimate); 615 List<int> line_ends(line_count_estimate);
616 Isolate* isolate = src->GetIsolate(); 616 Isolate* isolate = src->GetIsolate();
617 { 617 {
618 AssertNoAllocation no_heap_allocation; // ensure vectors stay valid. 618 AssertNoAllocation no_heap_allocation; // ensure vectors stay valid.
619 // Dispatch on type of strings. 619 // Dispatch on type of strings.
620 if (src->IsAsciiRepresentation()) { 620 String::FlatContent content = src->GetFlatContent(no_heap_allocation);
621 ASSERT(content.IsFlat());
622 if (content.IsAscii()) {
621 CalculateLineEnds(isolate, 623 CalculateLineEnds(isolate,
622 &line_ends, 624 &line_ends,
623 src->ToAsciiVector(), 625 content.ToAsciiVector(),
624 with_last_line); 626 with_last_line);
625 } else { 627 } else {
626 CalculateLineEnds(isolate, 628 CalculateLineEnds(isolate,
627 &line_ends, 629 &line_ends,
628 src->ToUC16Vector(), 630 content.ToUC16Vector(),
629 with_last_line); 631 with_last_line);
630 } 632 }
631 } 633 }
632 int line_count = line_ends.length(); 634 int line_count = line_ends.length();
633 Handle<FixedArray> array = isolate->factory()->NewFixedArray(line_count); 635 Handle<FixedArray> array = isolate->factory()->NewFixedArray(line_count);
634 for (int i = 0; i < line_count; i++) { 636 for (int i = 0; i < line_count; i++) {
635 array->set(i, Smi::FromInt(line_ends[i])); 637 array->set(i, Smi::FromInt(line_ends[i]));
636 } 638 }
637 return array; 639 return array;
638 } 640 }
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 952
951 bool CompileOptimized(Handle<JSFunction> function, 953 bool CompileOptimized(Handle<JSFunction> function,
952 int osr_ast_id, 954 int osr_ast_id,
953 ClearExceptionFlag flag) { 955 ClearExceptionFlag flag) {
954 CompilationInfo info(function); 956 CompilationInfo info(function);
955 info.SetOptimizing(osr_ast_id); 957 info.SetOptimizing(osr_ast_id);
956 return CompileLazyHelper(&info, flag); 958 return CompileLazyHelper(&info, flag);
957 } 959 }
958 960
959 } } // namespace v8::internal 961 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698