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

Side by Side Diff: src/api.cc

Issue 223593004: Revert "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);
5462 // We do not expect this to fail. Change this if it does. 5464 // We do not expect this to fail. Change this if it does.
5463 i::Handle<i::String> result = isolate->factory()->NewConsString( 5465 CHECK(!result.is_null());
5464 left_string, right_string).ToHandleChecked();
5465 return Utils::ToLocal(result); 5466 return Utils::ToLocal(result);
5466 } 5467 }
5467 5468
5468 5469
5469 static i::Handle<i::String> NewExternalStringHandle( 5470 static i::Handle<i::String> NewExternalStringHandle(
5470 i::Isolate* isolate, 5471 i::Isolate* isolate,
5471 v8::String::ExternalStringResource* resource) { 5472 v8::String::ExternalStringResource* resource) {
5472 i::Handle<i::String> result = 5473 i::Handle<i::String> result =
5473 isolate->factory()->NewExternalStringFromTwoByte(resource); 5474 isolate->factory()->NewExternalStringFromTwoByte(resource);
5474 // We do not expect this to fail. Change this if it does. 5475 // We do not expect this to fail. Change this if it does.
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after
7025 } 7026 }
7026 7027
7027 7028
7028 #endif // ENABLE_DEBUGGER_SUPPORT 7029 #endif // ENABLE_DEBUGGER_SUPPORT
7029 7030
7030 7031
7031 Handle<String> CpuProfileNode::GetFunctionName() const { 7032 Handle<String> CpuProfileNode::GetFunctionName() const {
7032 i::Isolate* isolate = i::Isolate::Current(); 7033 i::Isolate* isolate = i::Isolate::Current();
7033 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 7034 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
7034 const i::CodeEntry* entry = node->entry(); 7035 const i::CodeEntry* entry = node->entry();
7035 i::Handle<i::String> name =
7036 isolate->factory()->InternalizeUtf8String(entry->name());
7037 if (!entry->has_name_prefix()) { 7036 if (!entry->has_name_prefix()) {
7038 return ToApiHandle<String>(name); 7037 return ToApiHandle<String>(
7038 isolate->factory()->InternalizeUtf8String(entry->name()));
7039 } else { 7039 } else {
7040 // We do not expect this to fail. Change this if it does.
7041 i::Handle<i::String> cons = isolate->factory()->NewConsString( 7040 i::Handle<i::String> cons = isolate->factory()->NewConsString(
7042 isolate->factory()->InternalizeUtf8String(entry->name_prefix()), 7041 isolate->factory()->InternalizeUtf8String(entry->name_prefix()),
7043 name).ToHandleChecked(); 7042 isolate->factory()->InternalizeUtf8String(entry->name()));
7043 // We do not expect this to fail. Change this if it does.
7044 CHECK(!cons.is_null());
7044 return ToApiHandle<String>(cons); 7045 return ToApiHandle<String>(cons);
7045 } 7046 }
7046 } 7047 }
7047 7048
7048 7049
7049 int CpuProfileNode::GetScriptId() const { 7050 int CpuProfileNode::GetScriptId() const {
7050 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 7051 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
7051 const i::CodeEntry* entry = node->entry(); 7052 const i::CodeEntry* entry = node->entry();
7052 return entry->script_id(); 7053 return entry->script_id();
7053 } 7054 }
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
7664 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7665 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7665 Address callback_address = 7666 Address callback_address =
7666 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7667 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7667 VMState<EXTERNAL> state(isolate); 7668 VMState<EXTERNAL> state(isolate);
7668 ExternalCallbackScope call_scope(isolate, callback_address); 7669 ExternalCallbackScope call_scope(isolate, callback_address);
7669 callback(info); 7670 callback(info);
7670 } 7671 }
7671 7672
7672 7673
7673 } } // namespace v8::internal 7674 } } // 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