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

Side by Side Diff: src/api.cc

Issue 223383002: Return MaybeHandle from NewConsString. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comment Created 6 years, 8 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/factory.h » ('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 5441 matching lines...) Expand 10 before | Expand all | Expand 10 after
5452 } 5452 }
5453 5453
5454 5454
5455 Local<String> v8::String::Concat(Handle<String> left, Handle<String> right) { 5455 Local<String> v8::String::Concat(Handle<String> left, Handle<String> right) {
5456 i::Handle<i::String> left_string = Utils::OpenHandle(*left); 5456 i::Handle<i::String> left_string = Utils::OpenHandle(*left);
5457 i::Isolate* isolate = left_string->GetIsolate(); 5457 i::Isolate* isolate = left_string->GetIsolate();
5458 EnsureInitializedForIsolate(isolate, "v8::String::New()"); 5458 EnsureInitializedForIsolate(isolate, "v8::String::New()");
5459 LOG_API(isolate, "String::New(char)"); 5459 LOG_API(isolate, "String::New(char)");
5460 ENTER_V8(isolate); 5460 ENTER_V8(isolate);
5461 i::Handle<i::String> right_string = Utils::OpenHandle(*right); 5461 i::Handle<i::String> right_string = Utils::OpenHandle(*right);
5462 i::Handle<i::String> result = isolate->factory()->NewConsString(left_string,
5463 right_string);
5464 // We do not expect this to fail. Change this if it does. 5462 // We do not expect this to fail. Change this if it does.
5465 CHECK(!result.is_null()); 5463 i::Handle<i::String> result = isolate->factory()->NewConsString(
5464 left_string, right_string).ToHandleChecked();
5466 return Utils::ToLocal(result); 5465 return Utils::ToLocal(result);
5467 } 5466 }
5468 5467
5469 5468
5470 static i::Handle<i::String> NewExternalStringHandle( 5469 static i::Handle<i::String> NewExternalStringHandle(
5471 i::Isolate* isolate, 5470 i::Isolate* isolate,
5472 v8::String::ExternalStringResource* resource) { 5471 v8::String::ExternalStringResource* resource) {
5473 i::Handle<i::String> result = 5472 i::Handle<i::String> result =
5474 isolate->factory()->NewExternalStringFromTwoByte(resource); 5473 isolate->factory()->NewExternalStringFromTwoByte(resource);
5475 // We do not expect this to fail. Change this if it does. 5474 // We do not expect this to fail. Change this if it does.
(...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after
7012 } 7011 }
7013 7012
7014 7013
7015 #endif // ENABLE_DEBUGGER_SUPPORT 7014 #endif // ENABLE_DEBUGGER_SUPPORT
7016 7015
7017 7016
7018 Handle<String> CpuProfileNode::GetFunctionName() const { 7017 Handle<String> CpuProfileNode::GetFunctionName() const {
7019 i::Isolate* isolate = i::Isolate::Current(); 7018 i::Isolate* isolate = i::Isolate::Current();
7020 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 7019 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
7021 const i::CodeEntry* entry = node->entry(); 7020 const i::CodeEntry* entry = node->entry();
7021 i::Handle<i::String> name =
7022 isolate->factory()->InternalizeUtf8String(entry->name());
7022 if (!entry->has_name_prefix()) { 7023 if (!entry->has_name_prefix()) {
7023 return ToApiHandle<String>( 7024 return ToApiHandle<String>(name);
7024 isolate->factory()->InternalizeUtf8String(entry->name()));
7025 } else { 7025 } else {
7026 // We do not expect this to fail. Change this if it does.
7026 i::Handle<i::String> cons = isolate->factory()->NewConsString( 7027 i::Handle<i::String> cons = isolate->factory()->NewConsString(
7027 isolate->factory()->InternalizeUtf8String(entry->name_prefix()), 7028 isolate->factory()->InternalizeUtf8String(entry->name_prefix()),
7028 isolate->factory()->InternalizeUtf8String(entry->name())); 7029 name).ToHandleChecked();
7029 // We do not expect this to fail. Change this if it does.
7030 CHECK(!cons.is_null());
7031 return ToApiHandle<String>(cons); 7030 return ToApiHandle<String>(cons);
7032 } 7031 }
7033 } 7032 }
7034 7033
7035 7034
7036 int CpuProfileNode::GetScriptId() const { 7035 int CpuProfileNode::GetScriptId() const {
7037 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 7036 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
7038 const i::CodeEntry* entry = node->entry(); 7037 const i::CodeEntry* entry = node->entry();
7039 return entry->script_id(); 7038 return entry->script_id();
7040 } 7039 }
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
7651 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7650 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7652 Address callback_address = 7651 Address callback_address =
7653 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7652 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7654 VMState<EXTERNAL> state(isolate); 7653 VMState<EXTERNAL> state(isolate);
7655 ExternalCallbackScope call_scope(isolate, callback_address); 7654 ExternalCallbackScope call_scope(isolate, callback_address);
7656 callback(info); 7655 callback(info);
7657 } 7656 }
7658 7657
7659 7658
7660 } } // namespace v8::internal 7659 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698