| 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 5385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5396 i::Isolate* isolate = reinterpret_cast<internal::Isolate*>(v8_isolate); | 5396 i::Isolate* isolate = reinterpret_cast<internal::Isolate*>(v8_isolate); |
| 5397 EnsureInitializedForIsolate(isolate, location); | 5397 EnsureInitializedForIsolate(isolate, location); |
| 5398 LOG_API(isolate, env); | 5398 LOG_API(isolate, env); |
| 5399 if (length == 0 && type != String::kUndetectableString) { | 5399 if (length == 0 && type != String::kUndetectableString) { |
| 5400 return String::Empty(v8_isolate); | 5400 return String::Empty(v8_isolate); |
| 5401 } | 5401 } |
| 5402 ENTER_V8(isolate); | 5402 ENTER_V8(isolate); |
| 5403 if (length == -1) length = StringLength(data); | 5403 if (length == -1) length = StringLength(data); |
| 5404 i::Handle<i::String> result = NewString( | 5404 i::Handle<i::String> result = NewString( |
| 5405 isolate->factory(), type, i::Vector<const Char>(data, length)); | 5405 isolate->factory(), type, i::Vector<const Char>(data, length)); |
| 5406 // We do not expect this to fail. Change this if it does. |
| 5407 CHECK(!result.is_null()); |
| 5406 if (type == String::kUndetectableString) { | 5408 if (type == String::kUndetectableString) { |
| 5407 result->MarkAsUndetectable(); | 5409 result->MarkAsUndetectable(); |
| 5408 } | 5410 } |
| 5409 return Utils::ToLocal(result); | 5411 return Utils::ToLocal(result); |
| 5410 } | 5412 } |
| 5411 | 5413 |
| 5412 } // anonymous namespace | 5414 } // anonymous namespace |
| 5413 | 5415 |
| 5414 | 5416 |
| 5415 Local<String> String::NewFromUtf8(Isolate* isolate, | 5417 Local<String> String::NewFromUtf8(Isolate* isolate, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5453 | 5455 |
| 5454 Local<String> v8::String::Concat(Handle<String> left, Handle<String> right) { | 5456 Local<String> v8::String::Concat(Handle<String> left, Handle<String> right) { |
| 5455 i::Handle<i::String> left_string = Utils::OpenHandle(*left); | 5457 i::Handle<i::String> left_string = Utils::OpenHandle(*left); |
| 5456 i::Isolate* isolate = left_string->GetIsolate(); | 5458 i::Isolate* isolate = left_string->GetIsolate(); |
| 5457 EnsureInitializedForIsolate(isolate, "v8::String::New()"); | 5459 EnsureInitializedForIsolate(isolate, "v8::String::New()"); |
| 5458 LOG_API(isolate, "String::New(char)"); | 5460 LOG_API(isolate, "String::New(char)"); |
| 5459 ENTER_V8(isolate); | 5461 ENTER_V8(isolate); |
| 5460 i::Handle<i::String> right_string = Utils::OpenHandle(*right); | 5462 i::Handle<i::String> right_string = Utils::OpenHandle(*right); |
| 5461 i::Handle<i::String> result = isolate->factory()->NewConsString(left_string, | 5463 i::Handle<i::String> result = isolate->factory()->NewConsString(left_string, |
| 5462 right_string); | 5464 right_string); |
| 5463 // We do not expect this to throw an exception. Change this if it does. | 5465 // We do not expect this to fail. Change this if it does. |
| 5464 CHECK_NOT_EMPTY_HANDLE(isolate, result); | 5466 CHECK(!result.is_null()); |
| 5465 return Utils::ToLocal(result); | 5467 return Utils::ToLocal(result); |
| 5466 } | 5468 } |
| 5467 | 5469 |
| 5468 | 5470 |
| 5469 static i::Handle<i::String> NewExternalStringHandle( | 5471 static i::Handle<i::String> NewExternalStringHandle( |
| 5470 i::Isolate* isolate, | 5472 i::Isolate* isolate, |
| 5471 v8::String::ExternalStringResource* resource) { | 5473 v8::String::ExternalStringResource* resource) { |
| 5472 return isolate->factory()->NewExternalStringFromTwoByte(resource); | 5474 i::Handle<i::String> result = |
| 5475 isolate->factory()->NewExternalStringFromTwoByte(resource); |
| 5476 // We do not expect this to fail. Change this if it does. |
| 5477 CHECK(!result.is_null()); |
| 5478 return result; |
| 5473 } | 5479 } |
| 5474 | 5480 |
| 5475 | 5481 |
| 5476 static i::Handle<i::String> NewExternalAsciiStringHandle( | 5482 static i::Handle<i::String> NewExternalAsciiStringHandle( |
| 5477 i::Isolate* isolate, | 5483 i::Isolate* isolate, |
| 5478 v8::String::ExternalAsciiStringResource* resource) { | 5484 v8::String::ExternalAsciiStringResource* resource) { |
| 5479 return isolate->factory()->NewExternalStringFromAscii(resource); | 5485 i::Handle<i::String> result = |
| 5486 isolate->factory()->NewExternalStringFromAscii(resource); |
| 5487 // We do not expect this to fail. Change this if it does. |
| 5488 CHECK(!result.is_null()); |
| 5489 return result; |
| 5480 } | 5490 } |
| 5481 | 5491 |
| 5482 | 5492 |
| 5483 Local<String> v8::String::NewExternal( | 5493 Local<String> v8::String::NewExternal( |
| 5484 Isolate* isolate, | 5494 Isolate* isolate, |
| 5485 v8::String::ExternalStringResource* resource) { | 5495 v8::String::ExternalStringResource* resource) { |
| 5486 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 5496 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 5487 EnsureInitializedForIsolate(i_isolate, "v8::String::NewExternal()"); | 5497 EnsureInitializedForIsolate(i_isolate, "v8::String::NewExternal()"); |
| 5488 LOG_API(i_isolate, "String::NewExternal"); | 5498 LOG_API(i_isolate, "String::NewExternal"); |
| 5489 ENTER_V8(i_isolate); | 5499 ENTER_V8(i_isolate); |
| (...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6993 i::Isolate* isolate = i::Isolate::Current(); | 7003 i::Isolate* isolate = i::Isolate::Current(); |
| 6994 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); | 7004 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
| 6995 const i::CodeEntry* entry = node->entry(); | 7005 const i::CodeEntry* entry = node->entry(); |
| 6996 if (!entry->has_name_prefix()) { | 7006 if (!entry->has_name_prefix()) { |
| 6997 return ToApiHandle<String>( | 7007 return ToApiHandle<String>( |
| 6998 isolate->factory()->InternalizeUtf8String(entry->name())); | 7008 isolate->factory()->InternalizeUtf8String(entry->name())); |
| 6999 } else { | 7009 } else { |
| 7000 i::Handle<i::String> cons = isolate->factory()->NewConsString( | 7010 i::Handle<i::String> cons = isolate->factory()->NewConsString( |
| 7001 isolate->factory()->InternalizeUtf8String(entry->name_prefix()), | 7011 isolate->factory()->InternalizeUtf8String(entry->name_prefix()), |
| 7002 isolate->factory()->InternalizeUtf8String(entry->name())); | 7012 isolate->factory()->InternalizeUtf8String(entry->name())); |
| 7003 // We do not expect this to throw an exception. Change this if it does. | 7013 // We do not expect this to fail. Change this if it does. |
| 7004 CHECK_NOT_EMPTY_HANDLE(isolate, cons); | 7014 CHECK(!cons.is_null()); |
| 7005 return ToApiHandle<String>(cons); | 7015 return ToApiHandle<String>(cons); |
| 7006 } | 7016 } |
| 7007 } | 7017 } |
| 7008 | 7018 |
| 7009 | 7019 |
| 7010 int CpuProfileNode::GetScriptId() const { | 7020 int CpuProfileNode::GetScriptId() const { |
| 7011 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); | 7021 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
| 7012 const i::CodeEntry* entry = node->entry(); | 7022 const i::CodeEntry* entry = node->entry(); |
| 7013 return entry->script_id(); | 7023 return entry->script_id(); |
| 7014 } | 7024 } |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7625 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7635 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7626 Address callback_address = | 7636 Address callback_address = |
| 7627 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7637 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7628 VMState<EXTERNAL> state(isolate); | 7638 VMState<EXTERNAL> state(isolate); |
| 7629 ExternalCallbackScope call_scope(isolate, callback_address); | 7639 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7630 callback(info); | 7640 callback(info); |
| 7631 } | 7641 } |
| 7632 | 7642 |
| 7633 | 7643 |
| 7634 } } // namespace v8::internal | 7644 } } // namespace v8::internal |
| OLD | NEW |