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

Side by Side Diff: src/factory.cc

Issue 206383002: Revert "Throw exception on invalid string length instead of OOM." (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 | « src/api.cc ('k') | src/func-name-inferrer.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 // 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 370
371 if (length == 2) { 371 if (length == 2) {
372 uint16_t c1 = left->Get(0); 372 uint16_t c1 = left->Get(0);
373 uint16_t c2 = right->Get(0); 373 uint16_t c2 = right->Get(0);
374 return MakeOrFindTwoCharacterString(isolate(), c1, c2); 374 return MakeOrFindTwoCharacterString(isolate(), c1, c2);
375 } 375 }
376 376
377 // Make sure that an out of memory exception is thrown if the length 377 // Make sure that an out of memory exception is thrown if the length
378 // of the new cons string is too large. 378 // of the new cons string is too large.
379 if (length > String::kMaxLength || length < 0) { 379 if (length > String::kMaxLength || length < 0) {
380 isolate()->ThrowInvalidStringLength(); 380 isolate()->context()->mark_out_of_memory();
381 V8::FatalProcessOutOfMemory("String concatenation result too large.");
382 UNREACHABLE();
381 return Handle<String>::null(); 383 return Handle<String>::null();
382 } 384 }
383 385
384 bool left_is_one_byte = left->IsOneByteRepresentation(); 386 bool left_is_one_byte = left->IsOneByteRepresentation();
385 bool right_is_one_byte = right->IsOneByteRepresentation(); 387 bool right_is_one_byte = right->IsOneByteRepresentation();
386 bool is_one_byte = left_is_one_byte && right_is_one_byte; 388 bool is_one_byte = left_is_one_byte && right_is_one_byte;
387 bool is_one_byte_data_in_two_byte_string = false; 389 bool is_one_byte_data_in_two_byte_string = false;
388 if (!is_one_byte) { 390 if (!is_one_byte) {
389 // At least one of the strings uses two-byte representation so we 391 // At least one of the strings uses two-byte representation so we
390 // can't use the fast case code for short ASCII strings below, but 392 // can't use the fast case code for short ASCII strings below, but
(...skipping 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after
2032 return Handle<Object>::null(); 2034 return Handle<Object>::null();
2033 } 2035 }
2034 2036
2035 2037
2036 Handle<Object> Factory::ToBoolean(bool value) { 2038 Handle<Object> Factory::ToBoolean(bool value) {
2037 return value ? true_value() : false_value(); 2039 return value ? true_value() : false_value();
2038 } 2040 }
2039 2041
2040 2042
2041 } } // namespace v8::internal 2043 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/func-name-inferrer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698