OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/api.h" | 5 #include "src/api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
(...skipping 3278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3289 | 3289 |
3290 // Native implementation of Object.prototype.toString (v8natives.js): | 3290 // Native implementation of Object.prototype.toString (v8natives.js): |
3291 // var c = %_ClassOf(this); | 3291 // var c = %_ClassOf(this); |
3292 // if (c === 'Arguments') c = 'Object'; | 3292 // if (c === 'Arguments') c = 'Object'; |
3293 // return "[object " + c + "]"; | 3293 // return "[object " + c + "]"; |
3294 | 3294 |
3295 if (!name->IsString()) { | 3295 if (!name->IsString()) { |
3296 return v8::String::NewFromUtf8(isolate, "[object ]"); | 3296 return v8::String::NewFromUtf8(isolate, "[object ]"); |
3297 } else { | 3297 } else { |
3298 i::Handle<i::String> class_name = i::Handle<i::String>::cast(name); | 3298 i::Handle<i::String> class_name = i::Handle<i::String>::cast(name); |
3299 if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Arguments"))) { | 3299 if (i::String::Equals(class_name, |
| 3300 i_isolate->factory()->Arguments_string())) { |
3300 return v8::String::NewFromUtf8(isolate, "[object Object]"); | 3301 return v8::String::NewFromUtf8(isolate, "[object Object]"); |
3301 } else { | 3302 } else { |
3302 const char* prefix = "[object "; | 3303 const char* prefix = "[object "; |
3303 Local<String> str = Utils::ToLocal(class_name); | 3304 Local<String> str = Utils::ToLocal(class_name); |
3304 const char* postfix = "]"; | 3305 const char* postfix = "]"; |
3305 | 3306 |
3306 int prefix_len = i::StrLength(prefix); | 3307 int prefix_len = i::StrLength(prefix); |
3307 int str_len = str->Utf8Length(); | 3308 int str_len = str->Utf8Length(); |
3308 int postfix_len = i::StrLength(postfix); | 3309 int postfix_len = i::StrLength(postfix); |
3309 | 3310 |
(...skipping 4321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7631 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7632 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7632 Address callback_address = | 7633 Address callback_address = |
7633 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7634 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7634 VMState<EXTERNAL> state(isolate); | 7635 VMState<EXTERNAL> state(isolate); |
7635 ExternalCallbackScope call_scope(isolate, callback_address); | 7636 ExternalCallbackScope call_scope(isolate, callback_address); |
7636 callback(info); | 7637 callback(info); |
7637 } | 7638 } |
7638 | 7639 |
7639 | 7640 |
7640 } } // namespace v8::internal | 7641 } } // namespace v8::internal |
OLD | NEW |