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

Side by Side Diff: src/api.cc

Issue 735763002: v8::String::Concat must not throw. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | test/cctest/test-api.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 // 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/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 5532 matching lines...) Expand 10 before | Expand all | Expand 10 after
5543 length); 5543 length);
5544 } 5544 }
5545 5545
5546 5546
5547 Local<String> v8::String::Concat(Handle<String> left, Handle<String> right) { 5547 Local<String> v8::String::Concat(Handle<String> left, Handle<String> right) {
5548 i::Handle<i::String> left_string = Utils::OpenHandle(*left); 5548 i::Handle<i::String> left_string = Utils::OpenHandle(*left);
5549 i::Isolate* isolate = left_string->GetIsolate(); 5549 i::Isolate* isolate = left_string->GetIsolate();
5550 LOG_API(isolate, "String::New(char)"); 5550 LOG_API(isolate, "String::New(char)");
5551 ENTER_V8(isolate); 5551 ENTER_V8(isolate);
5552 i::Handle<i::String> right_string = Utils::OpenHandle(*right); 5552 i::Handle<i::String> right_string = Utils::OpenHandle(*right);
5553 // We do not expect this to fail. Change this if it does. 5553 // If we are steering towards a range error, do not wait for the error to be
5554 // thrown, and return the null handle instead.
5555 if (left_string->length() + right_string->length() > i::String::kMaxLength) {
5556 return Local<String>();
5557 }
5554 i::Handle<i::String> result = isolate->factory()->NewConsString( 5558 i::Handle<i::String> result = isolate->factory()->NewConsString(
5555 left_string, right_string).ToHandleChecked(); 5559 left_string, right_string).ToHandleChecked();
5556 return Utils::ToLocal(result); 5560 return Utils::ToLocal(result);
5557 } 5561 }
5558 5562
5559 5563
5560 static i::MaybeHandle<i::String> NewExternalStringHandle( 5564 static i::MaybeHandle<i::String> NewExternalStringHandle(
5561 i::Isolate* isolate, v8::String::ExternalStringResource* resource) { 5565 i::Isolate* isolate, v8::String::ExternalStringResource* resource) {
5562 return isolate->factory()->NewExternalStringFromTwoByte(resource); 5566 return isolate->factory()->NewExternalStringFromTwoByte(resource);
5563 } 5567 }
(...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after
7783 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7787 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7784 Address callback_address = 7788 Address callback_address =
7785 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7789 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7786 VMState<EXTERNAL> state(isolate); 7790 VMState<EXTERNAL> state(isolate);
7787 ExternalCallbackScope call_scope(isolate, callback_address); 7791 ExternalCallbackScope call_scope(isolate, callback_address);
7788 callback(info); 7792 callback(info);
7789 } 7793 }
7790 7794
7791 7795
7792 } } // namespace v8::internal 7796 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698