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

Side by Side Diff: src/api.cc

Issue 223813002: Reland "Return MaybeHandle from NewConsString." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after
7026 } 7025 }
7027 7026
7028 7027
7029 #endif // ENABLE_DEBUGGER_SUPPORT 7028 #endif // ENABLE_DEBUGGER_SUPPORT
7030 7029
7031 7030
7032 Handle<String> CpuProfileNode::GetFunctionName() const { 7031 Handle<String> CpuProfileNode::GetFunctionName() const {
7033 i::Isolate* isolate = i::Isolate::Current(); 7032 i::Isolate* isolate = i::Isolate::Current();
7034 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 7033 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
7035 const i::CodeEntry* entry = node->entry(); 7034 const i::CodeEntry* entry = node->entry();
7035 i::Handle<i::String> name =
7036 isolate->factory()->InternalizeUtf8String(entry->name());
7036 if (!entry->has_name_prefix()) { 7037 if (!entry->has_name_prefix()) {
7037 return ToApiHandle<String>( 7038 return ToApiHandle<String>(name);
7038 isolate->factory()->InternalizeUtf8String(entry->name()));
7039 } else { 7039 } else {
7040 // We do not expect this to fail. Change this if it does.
7040 i::Handle<i::String> cons = isolate->factory()->NewConsString( 7041 i::Handle<i::String> cons = isolate->factory()->NewConsString(
7041 isolate->factory()->InternalizeUtf8String(entry->name_prefix()), 7042 isolate->factory()->InternalizeUtf8String(entry->name_prefix()),
7042 isolate->factory()->InternalizeUtf8String(entry->name())); 7043 name).ToHandleChecked();
7043 // We do not expect this to fail. Change this if it does.
7044 CHECK(!cons.is_null());
7045 return ToApiHandle<String>(cons); 7044 return ToApiHandle<String>(cons);
7046 } 7045 }
7047 } 7046 }
7048 7047
7049 7048
7050 int CpuProfileNode::GetScriptId() const { 7049 int CpuProfileNode::GetScriptId() const {
7051 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 7050 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
7052 const i::CodeEntry* entry = node->entry(); 7051 const i::CodeEntry* entry = node->entry();
7053 return entry->script_id(); 7052 return entry->script_id();
7054 } 7053 }
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
7665 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7664 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7666 Address callback_address = 7665 Address callback_address =
7667 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7666 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7668 VMState<EXTERNAL> state(isolate); 7667 VMState<EXTERNAL> state(isolate);
7669 ExternalCallbackScope call_scope(isolate, callback_address); 7668 ExternalCallbackScope call_scope(isolate, callback_address);
7670 callback(info); 7669 callback(info);
7671 } 7670 }
7672 7671
7673 7672
7674 } } // namespace v8::internal 7673 } } // 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