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 2550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2561 } | 2561 } |
2562 } | 2562 } |
2563 | 2563 |
2564 | 2564 |
2565 bool Value::IsRegExp() const { | 2565 bool Value::IsRegExp() const { |
2566 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2566 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
2567 return obj->IsJSRegExp(); | 2567 return obj->IsJSRegExp(); |
2568 } | 2568 } |
2569 | 2569 |
2570 | 2570 |
| 2571 bool Value::IsGeneratorFunction() const { |
| 2572 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 2573 if (!obj->IsJSFunction()) return false; |
| 2574 i::Handle<i::JSFunction> func = i::Handle<i::JSFunction>::cast(obj); |
| 2575 return func->shared()->is_generator(); |
| 2576 } |
| 2577 |
| 2578 |
| 2579 bool Value::IsGeneratorObject() const { |
| 2580 return Utils::OpenHandle(this)->IsJSGeneratorObject(); |
| 2581 } |
| 2582 |
| 2583 |
2571 Local<String> Value::ToString() const { | 2584 Local<String> Value::ToString() const { |
2572 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2585 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
2573 i::Handle<i::Object> str; | 2586 i::Handle<i::Object> str; |
2574 if (obj->IsString()) { | 2587 if (obj->IsString()) { |
2575 str = obj; | 2588 str = obj; |
2576 } else { | 2589 } else { |
2577 i::Isolate* isolate = i::Isolate::Current(); | 2590 i::Isolate* isolate = i::Isolate::Current(); |
2578 LOG_API(isolate, "ToString"); | 2591 LOG_API(isolate, "ToString"); |
2579 ENTER_V8(isolate); | 2592 ENTER_V8(isolate); |
2580 EXCEPTION_PREAMBLE(isolate); | 2593 EXCEPTION_PREAMBLE(isolate); |
(...skipping 5074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7655 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7668 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7656 Address callback_address = | 7669 Address callback_address = |
7657 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7670 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7658 VMState<EXTERNAL> state(isolate); | 7671 VMState<EXTERNAL> state(isolate); |
7659 ExternalCallbackScope call_scope(isolate, callback_address); | 7672 ExternalCallbackScope call_scope(isolate, callback_address); |
7660 callback(info); | 7673 callback(info); |
7661 } | 7674 } |
7662 | 7675 |
7663 | 7676 |
7664 } } // namespace v8::internal | 7677 } } // namespace v8::internal |
OLD | NEW |