OLD | NEW |
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 5457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5468 | 5468 |
5469 Local<String> v8::String::Concat(Handle<String> left, Handle<String> right) { | 5469 Local<String> v8::String::Concat(Handle<String> left, Handle<String> right) { |
5470 i::Handle<i::String> left_string = Utils::OpenHandle(*left); | 5470 i::Handle<i::String> left_string = Utils::OpenHandle(*left); |
5471 i::Isolate* isolate = left_string->GetIsolate(); | 5471 i::Isolate* isolate = left_string->GetIsolate(); |
5472 EnsureInitializedForIsolate(isolate, "v8::String::New()"); | 5472 EnsureInitializedForIsolate(isolate, "v8::String::New()"); |
5473 LOG_API(isolate, "String::New(char)"); | 5473 LOG_API(isolate, "String::New(char)"); |
5474 ENTER_V8(isolate); | 5474 ENTER_V8(isolate); |
5475 i::Handle<i::String> right_string = Utils::OpenHandle(*right); | 5475 i::Handle<i::String> right_string = Utils::OpenHandle(*right); |
5476 i::Handle<i::String> result = isolate->factory()->NewConsString(left_string, | 5476 i::Handle<i::String> result = isolate->factory()->NewConsString(left_string, |
5477 right_string); | 5477 right_string); |
5478 // We do not expect this to throw an exception. Change this if it does. | |
5479 CHECK_NOT_EMPTY_HANDLE(isolate, result); | |
5480 return Utils::ToLocal(result); | 5478 return Utils::ToLocal(result); |
5481 } | 5479 } |
5482 | 5480 |
5483 | 5481 |
5484 static i::Handle<i::String> NewExternalStringHandle( | 5482 static i::Handle<i::String> NewExternalStringHandle( |
5485 i::Isolate* isolate, | 5483 i::Isolate* isolate, |
5486 v8::String::ExternalStringResource* resource) { | 5484 v8::String::ExternalStringResource* resource) { |
5487 return isolate->factory()->NewExternalStringFromTwoByte(resource); | 5485 return isolate->factory()->NewExternalStringFromTwoByte(resource); |
5488 } | 5486 } |
5489 | 5487 |
(...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6961 | 6959 |
6962 | 6960 |
6963 Handle<String> CpuProfileNode::GetFunctionName() const { | 6961 Handle<String> CpuProfileNode::GetFunctionName() const { |
6964 i::Isolate* isolate = i::Isolate::Current(); | 6962 i::Isolate* isolate = i::Isolate::Current(); |
6965 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); | 6963 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
6966 const i::CodeEntry* entry = node->entry(); | 6964 const i::CodeEntry* entry = node->entry(); |
6967 if (!entry->has_name_prefix()) { | 6965 if (!entry->has_name_prefix()) { |
6968 return ToApiHandle<String>( | 6966 return ToApiHandle<String>( |
6969 isolate->factory()->InternalizeUtf8String(entry->name())); | 6967 isolate->factory()->InternalizeUtf8String(entry->name())); |
6970 } else { | 6968 } else { |
6971 i::Handle<i::String> cons = isolate->factory()->NewConsString( | 6969 return ToApiHandle<String>(isolate->factory()->NewConsString( |
6972 isolate->factory()->InternalizeUtf8String(entry->name_prefix()), | 6970 isolate->factory()->InternalizeUtf8String(entry->name_prefix()), |
6973 isolate->factory()->InternalizeUtf8String(entry->name())); | 6971 isolate->factory()->InternalizeUtf8String(entry->name()))); |
6974 // We do not expect this to throw an exception. Change this if it does. | |
6975 CHECK_NOT_EMPTY_HANDLE(isolate, cons); | |
6976 return ToApiHandle<String>(cons); | |
6977 } | 6972 } |
6978 } | 6973 } |
6979 | 6974 |
6980 | 6975 |
6981 int CpuProfileNode::GetScriptId() const { | 6976 int CpuProfileNode::GetScriptId() const { |
6982 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); | 6977 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
6983 const i::CodeEntry* entry = node->entry(); | 6978 const i::CodeEntry* entry = node->entry(); |
6984 return entry->script_id(); | 6979 return entry->script_id(); |
6985 } | 6980 } |
6986 | 6981 |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7596 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7591 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7597 Address callback_address = | 7592 Address callback_address = |
7598 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7593 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7599 VMState<EXTERNAL> state(isolate); | 7594 VMState<EXTERNAL> state(isolate); |
7600 ExternalCallbackScope call_scope(isolate, callback_address); | 7595 ExternalCallbackScope call_scope(isolate, callback_address); |
7601 callback(info); | 7596 callback(info); |
7602 } | 7597 } |
7603 | 7598 |
7604 | 7599 |
7605 } } // namespace v8::internal | 7600 } } // namespace v8::internal |
OLD | NEW |