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

Side by Side Diff: tools/lexer-shell.cc

Issue 210143002: Revert "No longer OOM on invalid string length." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « test/mjsunit/string-oom-replace-global-regexp-with-string.js ('k') | no next file » | 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 // 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 scanner_ = new Scanner(unicode_cache_); 61 scanner_ = new Scanner(unicode_cache_);
62 switch (encoding) { 62 switch (encoding) {
63 case UTF8: 63 case UTF8:
64 stream_ = new Utf8ToUtf16CharacterStream(source_, length); 64 stream_ = new Utf8ToUtf16CharacterStream(source_, length);
65 break; 65 break;
66 case UTF16: { 66 case UTF16: {
67 Handle<String> result = isolate->factory()->NewStringFromTwoByte( 67 Handle<String> result = isolate->factory()->NewStringFromTwoByte(
68 Vector<const uint16_t>( 68 Vector<const uint16_t>(
69 reinterpret_cast<const uint16_t*>(source_), 69 reinterpret_cast<const uint16_t*>(source_),
70 length / 2)); 70 length / 2));
71 CHECK_NOT_EMPTY_HANDLE(isolate, result);
72 stream_ = 71 stream_ =
73 new GenericStringUtf16CharacterStream(result, 0, result->length()); 72 new GenericStringUtf16CharacterStream(result, 0, result->length());
74 break; 73 break;
75 } 74 }
76 case LATIN1: { 75 case LATIN1: {
77 Handle<String> result = isolate->factory()->NewStringFromOneByte( 76 Handle<String> result = isolate->factory()->NewStringFromOneByte(
78 Vector<const uint8_t>(source_, length)); 77 Vector<const uint8_t>(source_, length));
79 CHECK_NOT_EMPTY_HANDLE(isolate, result);
80 stream_ = 78 stream_ =
81 new GenericStringUtf16CharacterStream(result, 0, result->length()); 79 new GenericStringUtf16CharacterStream(result, 0, result->length());
82 break; 80 break;
83 } 81 }
84 } 82 }
85 timer->Start(); 83 timer->Start();
86 scanner_->Initialize(stream_); 84 scanner_->Initialize(stream_);
87 } 85 }
88 86
89 ~BaselineScanner() { 87 ~BaselineScanner() {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 repeat); 222 repeat);
225 baseline_total += time.InMillisecondsF(); 223 baseline_total += time.InMillisecondsF();
226 } 224 }
227 if (benchmark.empty()) benchmark = "Baseline"; 225 if (benchmark.empty()) benchmark = "Baseline";
228 printf("%s(RunTime): %.f ms\n", benchmark.c_str(), baseline_total); 226 printf("%s(RunTime): %.f ms\n", benchmark.c_str(), baseline_total);
229 } 227 }
230 } 228 }
231 v8::V8::Dispose(); 229 v8::V8::Dispose();
232 return 0; 230 return 0;
233 } 231 }
OLDNEW
« no previous file with comments | « test/mjsunit/string-oom-replace-global-regexp-with-string.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698