| 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 2720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2731 if (obj->IsString()) { | 2731 if (obj->IsString()) { |
| 2732 str = obj; | 2732 str = obj; |
| 2733 } else { | 2733 } else { |
| 2734 i::Isolate* isolate = i::Isolate::Current(); | 2734 i::Isolate* isolate = i::Isolate::Current(); |
| 2735 if (IsDeadCheck(isolate, "v8::Value::ToString()")) { | 2735 if (IsDeadCheck(isolate, "v8::Value::ToString()")) { |
| 2736 return Local<String>(); | 2736 return Local<String>(); |
| 2737 } | 2737 } |
| 2738 LOG_API(isolate, "ToString"); | 2738 LOG_API(isolate, "ToString"); |
| 2739 ENTER_V8(isolate); | 2739 ENTER_V8(isolate); |
| 2740 EXCEPTION_PREAMBLE(isolate); | 2740 EXCEPTION_PREAMBLE(isolate); |
| 2741 str = i::Execution::ToString(obj, &has_pending_exception); | 2741 str = i::Execution::ToString(isolate, obj, &has_pending_exception); |
| 2742 EXCEPTION_BAILOUT_CHECK(isolate, Local<String>()); | 2742 EXCEPTION_BAILOUT_CHECK(isolate, Local<String>()); |
| 2743 } | 2743 } |
| 2744 return ToApiHandle<String>(str); | 2744 return ToApiHandle<String>(str); |
| 2745 } | 2745 } |
| 2746 | 2746 |
| 2747 | 2747 |
| 2748 Local<String> Value::ToDetailString() const { | 2748 Local<String> Value::ToDetailString() const { |
| 2749 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2749 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 2750 i::Handle<i::Object> str; | 2750 i::Handle<i::Object> str; |
| 2751 if (obj->IsString()) { | 2751 if (obj->IsString()) { |
| 2752 str = obj; | 2752 str = obj; |
| 2753 } else { | 2753 } else { |
| 2754 i::Isolate* isolate = i::Isolate::Current(); | 2754 i::Isolate* isolate = i::Isolate::Current(); |
| 2755 if (IsDeadCheck(isolate, "v8::Value::ToDetailString()")) { | 2755 if (IsDeadCheck(isolate, "v8::Value::ToDetailString()")) { |
| 2756 return Local<String>(); | 2756 return Local<String>(); |
| 2757 } | 2757 } |
| 2758 LOG_API(isolate, "ToDetailString"); | 2758 LOG_API(isolate, "ToDetailString"); |
| 2759 ENTER_V8(isolate); | 2759 ENTER_V8(isolate); |
| 2760 EXCEPTION_PREAMBLE(isolate); | 2760 EXCEPTION_PREAMBLE(isolate); |
| 2761 str = i::Execution::ToDetailString(obj, &has_pending_exception); | 2761 str = i::Execution::ToDetailString(isolate, obj, &has_pending_exception); |
| 2762 EXCEPTION_BAILOUT_CHECK(isolate, Local<String>()); | 2762 EXCEPTION_BAILOUT_CHECK(isolate, Local<String>()); |
| 2763 } | 2763 } |
| 2764 return ToApiHandle<String>(str); | 2764 return ToApiHandle<String>(str); |
| 2765 } | 2765 } |
| 2766 | 2766 |
| 2767 | 2767 |
| 2768 Local<v8::Object> Value::ToObject() const { | 2768 Local<v8::Object> Value::ToObject() const { |
| 2769 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2769 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 2770 i::Handle<i::Object> val; | 2770 i::Handle<i::Object> val; |
| 2771 if (obj->IsJSObject()) { | 2771 if (obj->IsJSObject()) { |
| 2772 val = obj; | 2772 val = obj; |
| 2773 } else { | 2773 } else { |
| 2774 i::Isolate* isolate = i::Isolate::Current(); | 2774 i::Isolate* isolate = i::Isolate::Current(); |
| 2775 if (IsDeadCheck(isolate, "v8::Value::ToObject()")) { | 2775 if (IsDeadCheck(isolate, "v8::Value::ToObject()")) { |
| 2776 return Local<v8::Object>(); | 2776 return Local<v8::Object>(); |
| 2777 } | 2777 } |
| 2778 LOG_API(isolate, "ToObject"); | 2778 LOG_API(isolate, "ToObject"); |
| 2779 ENTER_V8(isolate); | 2779 ENTER_V8(isolate); |
| 2780 EXCEPTION_PREAMBLE(isolate); | 2780 EXCEPTION_PREAMBLE(isolate); |
| 2781 val = i::Execution::ToObject(obj, &has_pending_exception); | 2781 val = i::Execution::ToObject(isolate, obj, &has_pending_exception); |
| 2782 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); | 2782 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); |
| 2783 } | 2783 } |
| 2784 return ToApiHandle<Object>(val); | 2784 return ToApiHandle<Object>(val); |
| 2785 } | 2785 } |
| 2786 | 2786 |
| 2787 | 2787 |
| 2788 Local<Boolean> Value::ToBoolean() const { | 2788 Local<Boolean> Value::ToBoolean() const { |
| 2789 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2789 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 2790 if (obj->IsBoolean()) { | 2790 if (obj->IsBoolean()) { |
| 2791 return ToApiHandle<Boolean>(obj); | 2791 return ToApiHandle<Boolean>(obj); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2809 if (obj->IsNumber()) { | 2809 if (obj->IsNumber()) { |
| 2810 num = obj; | 2810 num = obj; |
| 2811 } else { | 2811 } else { |
| 2812 i::Isolate* isolate = i::Isolate::Current(); | 2812 i::Isolate* isolate = i::Isolate::Current(); |
| 2813 if (IsDeadCheck(isolate, "v8::Value::ToNumber()")) { | 2813 if (IsDeadCheck(isolate, "v8::Value::ToNumber()")) { |
| 2814 return Local<Number>(); | 2814 return Local<Number>(); |
| 2815 } | 2815 } |
| 2816 LOG_API(isolate, "ToNumber"); | 2816 LOG_API(isolate, "ToNumber"); |
| 2817 ENTER_V8(isolate); | 2817 ENTER_V8(isolate); |
| 2818 EXCEPTION_PREAMBLE(isolate); | 2818 EXCEPTION_PREAMBLE(isolate); |
| 2819 num = i::Execution::ToNumber(obj, &has_pending_exception); | 2819 num = i::Execution::ToNumber(isolate, obj, &has_pending_exception); |
| 2820 EXCEPTION_BAILOUT_CHECK(isolate, Local<Number>()); | 2820 EXCEPTION_BAILOUT_CHECK(isolate, Local<Number>()); |
| 2821 } | 2821 } |
| 2822 return ToApiHandle<Number>(num); | 2822 return ToApiHandle<Number>(num); |
| 2823 } | 2823 } |
| 2824 | 2824 |
| 2825 | 2825 |
| 2826 Local<Integer> Value::ToInteger() const { | 2826 Local<Integer> Value::ToInteger() const { |
| 2827 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2827 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 2828 i::Handle<i::Object> num; | 2828 i::Handle<i::Object> num; |
| 2829 if (obj->IsSmi()) { | 2829 if (obj->IsSmi()) { |
| 2830 num = obj; | 2830 num = obj; |
| 2831 } else { | 2831 } else { |
| 2832 i::Isolate* isolate = i::Isolate::Current(); | 2832 i::Isolate* isolate = i::Isolate::Current(); |
| 2833 if (IsDeadCheck(isolate, "v8::Value::ToInteger()")) return Local<Integer>(); | 2833 if (IsDeadCheck(isolate, "v8::Value::ToInteger()")) return Local<Integer>(); |
| 2834 LOG_API(isolate, "ToInteger"); | 2834 LOG_API(isolate, "ToInteger"); |
| 2835 ENTER_V8(isolate); | 2835 ENTER_V8(isolate); |
| 2836 EXCEPTION_PREAMBLE(isolate); | 2836 EXCEPTION_PREAMBLE(isolate); |
| 2837 num = i::Execution::ToInteger(obj, &has_pending_exception); | 2837 num = i::Execution::ToInteger(isolate, obj, &has_pending_exception); |
| 2838 EXCEPTION_BAILOUT_CHECK(isolate, Local<Integer>()); | 2838 EXCEPTION_BAILOUT_CHECK(isolate, Local<Integer>()); |
| 2839 } | 2839 } |
| 2840 return ToApiHandle<Integer>(num); | 2840 return ToApiHandle<Integer>(num); |
| 2841 } | 2841 } |
| 2842 | 2842 |
| 2843 | 2843 |
| 2844 void i::Internals::CheckInitializedImpl(v8::Isolate* external_isolate) { | 2844 void i::Internals::CheckInitializedImpl(v8::Isolate* external_isolate) { |
| 2845 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate); | 2845 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate); |
| 2846 ApiCheck(isolate != NULL && isolate->IsInitialized() && !i::V8::IsDead(), | 2846 ApiCheck(isolate != NULL && isolate->IsInitialized() && !i::V8::IsDead(), |
| 2847 "v8::internal::Internals::CheckInitialized()", | 2847 "v8::internal::Internals::CheckInitialized()", |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3047 if (obj->IsNumber()) { | 3047 if (obj->IsNumber()) { |
| 3048 num = obj; | 3048 num = obj; |
| 3049 } else { | 3049 } else { |
| 3050 i::Isolate* isolate = i::Isolate::Current(); | 3050 i::Isolate* isolate = i::Isolate::Current(); |
| 3051 if (IsDeadCheck(isolate, "v8::Value::NumberValue()")) { | 3051 if (IsDeadCheck(isolate, "v8::Value::NumberValue()")) { |
| 3052 return i::OS::nan_value(); | 3052 return i::OS::nan_value(); |
| 3053 } | 3053 } |
| 3054 LOG_API(isolate, "NumberValue"); | 3054 LOG_API(isolate, "NumberValue"); |
| 3055 ENTER_V8(isolate); | 3055 ENTER_V8(isolate); |
| 3056 EXCEPTION_PREAMBLE(isolate); | 3056 EXCEPTION_PREAMBLE(isolate); |
| 3057 num = i::Execution::ToNumber(obj, &has_pending_exception); | 3057 num = i::Execution::ToNumber(isolate, obj, &has_pending_exception); |
| 3058 EXCEPTION_BAILOUT_CHECK(isolate, i::OS::nan_value()); | 3058 EXCEPTION_BAILOUT_CHECK(isolate, i::OS::nan_value()); |
| 3059 } | 3059 } |
| 3060 return num->Number(); | 3060 return num->Number(); |
| 3061 } | 3061 } |
| 3062 | 3062 |
| 3063 | 3063 |
| 3064 int64_t Value::IntegerValue() const { | 3064 int64_t Value::IntegerValue() const { |
| 3065 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 3065 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 3066 i::Handle<i::Object> num; | 3066 i::Handle<i::Object> num; |
| 3067 if (obj->IsNumber()) { | 3067 if (obj->IsNumber()) { |
| 3068 num = obj; | 3068 num = obj; |
| 3069 } else { | 3069 } else { |
| 3070 i::Isolate* isolate = i::Isolate::Current(); | 3070 i::Isolate* isolate = i::Isolate::Current(); |
| 3071 if (IsDeadCheck(isolate, "v8::Value::IntegerValue()")) return 0; | 3071 if (IsDeadCheck(isolate, "v8::Value::IntegerValue()")) return 0; |
| 3072 LOG_API(isolate, "IntegerValue"); | 3072 LOG_API(isolate, "IntegerValue"); |
| 3073 ENTER_V8(isolate); | 3073 ENTER_V8(isolate); |
| 3074 EXCEPTION_PREAMBLE(isolate); | 3074 EXCEPTION_PREAMBLE(isolate); |
| 3075 num = i::Execution::ToInteger(obj, &has_pending_exception); | 3075 num = i::Execution::ToInteger(isolate, obj, &has_pending_exception); |
| 3076 EXCEPTION_BAILOUT_CHECK(isolate, 0); | 3076 EXCEPTION_BAILOUT_CHECK(isolate, 0); |
| 3077 } | 3077 } |
| 3078 if (num->IsSmi()) { | 3078 if (num->IsSmi()) { |
| 3079 return i::Smi::cast(*num)->value(); | 3079 return i::Smi::cast(*num)->value(); |
| 3080 } else { | 3080 } else { |
| 3081 return static_cast<int64_t>(num->Number()); | 3081 return static_cast<int64_t>(num->Number()); |
| 3082 } | 3082 } |
| 3083 } | 3083 } |
| 3084 | 3084 |
| 3085 | 3085 |
| 3086 Local<Int32> Value::ToInt32() const { | 3086 Local<Int32> Value::ToInt32() const { |
| 3087 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 3087 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 3088 i::Handle<i::Object> num; | 3088 i::Handle<i::Object> num; |
| 3089 if (obj->IsSmi()) { | 3089 if (obj->IsSmi()) { |
| 3090 num = obj; | 3090 num = obj; |
| 3091 } else { | 3091 } else { |
| 3092 i::Isolate* isolate = i::Isolate::Current(); | 3092 i::Isolate* isolate = i::Isolate::Current(); |
| 3093 if (IsDeadCheck(isolate, "v8::Value::ToInt32()")) return Local<Int32>(); | 3093 if (IsDeadCheck(isolate, "v8::Value::ToInt32()")) return Local<Int32>(); |
| 3094 LOG_API(isolate, "ToInt32"); | 3094 LOG_API(isolate, "ToInt32"); |
| 3095 ENTER_V8(isolate); | 3095 ENTER_V8(isolate); |
| 3096 EXCEPTION_PREAMBLE(isolate); | 3096 EXCEPTION_PREAMBLE(isolate); |
| 3097 num = i::Execution::ToInt32(obj, &has_pending_exception); | 3097 num = i::Execution::ToInt32(isolate, obj, &has_pending_exception); |
| 3098 EXCEPTION_BAILOUT_CHECK(isolate, Local<Int32>()); | 3098 EXCEPTION_BAILOUT_CHECK(isolate, Local<Int32>()); |
| 3099 } | 3099 } |
| 3100 return ToApiHandle<Int32>(num); | 3100 return ToApiHandle<Int32>(num); |
| 3101 } | 3101 } |
| 3102 | 3102 |
| 3103 | 3103 |
| 3104 Local<Uint32> Value::ToUint32() const { | 3104 Local<Uint32> Value::ToUint32() const { |
| 3105 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 3105 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 3106 i::Handle<i::Object> num; | 3106 i::Handle<i::Object> num; |
| 3107 if (obj->IsSmi()) { | 3107 if (obj->IsSmi()) { |
| 3108 num = obj; | 3108 num = obj; |
| 3109 } else { | 3109 } else { |
| 3110 i::Isolate* isolate = i::Isolate::Current(); | 3110 i::Isolate* isolate = i::Isolate::Current(); |
| 3111 if (IsDeadCheck(isolate, "v8::Value::ToUint32()")) return Local<Uint32>(); | 3111 if (IsDeadCheck(isolate, "v8::Value::ToUint32()")) return Local<Uint32>(); |
| 3112 LOG_API(isolate, "ToUInt32"); | 3112 LOG_API(isolate, "ToUInt32"); |
| 3113 ENTER_V8(isolate); | 3113 ENTER_V8(isolate); |
| 3114 EXCEPTION_PREAMBLE(isolate); | 3114 EXCEPTION_PREAMBLE(isolate); |
| 3115 num = i::Execution::ToUint32(obj, &has_pending_exception); | 3115 num = i::Execution::ToUint32(isolate, obj, &has_pending_exception); |
| 3116 EXCEPTION_BAILOUT_CHECK(isolate, Local<Uint32>()); | 3116 EXCEPTION_BAILOUT_CHECK(isolate, Local<Uint32>()); |
| 3117 } | 3117 } |
| 3118 return ToApiHandle<Uint32>(num); | 3118 return ToApiHandle<Uint32>(num); |
| 3119 } | 3119 } |
| 3120 | 3120 |
| 3121 | 3121 |
| 3122 Local<Uint32> Value::ToArrayIndex() const { | 3122 Local<Uint32> Value::ToArrayIndex() const { |
| 3123 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 3123 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 3124 if (obj->IsSmi()) { | 3124 if (obj->IsSmi()) { |
| 3125 if (i::Smi::cast(*obj)->value() >= 0) return Utils::Uint32ToLocal(obj); | 3125 if (i::Smi::cast(*obj)->value() >= 0) return Utils::Uint32ToLocal(obj); |
| 3126 return Local<Uint32>(); | 3126 return Local<Uint32>(); |
| 3127 } | 3127 } |
| 3128 i::Isolate* isolate = i::Isolate::Current(); | 3128 i::Isolate* isolate = i::Isolate::Current(); |
| 3129 if (IsDeadCheck(isolate, "v8::Value::ToArrayIndex()")) return Local<Uint32>(); | 3129 if (IsDeadCheck(isolate, "v8::Value::ToArrayIndex()")) return Local<Uint32>(); |
| 3130 LOG_API(isolate, "ToArrayIndex"); | 3130 LOG_API(isolate, "ToArrayIndex"); |
| 3131 ENTER_V8(isolate); | 3131 ENTER_V8(isolate); |
| 3132 EXCEPTION_PREAMBLE(isolate); | 3132 EXCEPTION_PREAMBLE(isolate); |
| 3133 i::Handle<i::Object> string_obj = | 3133 i::Handle<i::Object> string_obj = |
| 3134 i::Execution::ToString(obj, &has_pending_exception); | 3134 i::Execution::ToString(isolate, obj, &has_pending_exception); |
| 3135 EXCEPTION_BAILOUT_CHECK(isolate, Local<Uint32>()); | 3135 EXCEPTION_BAILOUT_CHECK(isolate, Local<Uint32>()); |
| 3136 i::Handle<i::String> str = i::Handle<i::String>::cast(string_obj); | 3136 i::Handle<i::String> str = i::Handle<i::String>::cast(string_obj); |
| 3137 uint32_t index; | 3137 uint32_t index; |
| 3138 if (str->AsArrayIndex(&index)) { | 3138 if (str->AsArrayIndex(&index)) { |
| 3139 i::Handle<i::Object> value; | 3139 i::Handle<i::Object> value; |
| 3140 if (index <= static_cast<uint32_t>(i::Smi::kMaxValue)) { | 3140 if (index <= static_cast<uint32_t>(i::Smi::kMaxValue)) { |
| 3141 value = i::Handle<i::Object>(i::Smi::FromInt(index), isolate); | 3141 value = i::Handle<i::Object>(i::Smi::FromInt(index), isolate); |
| 3142 } else { | 3142 } else { |
| 3143 value = isolate->factory()->NewNumber(index); | 3143 value = isolate->factory()->NewNumber(index); |
| 3144 } | 3144 } |
| 3145 return Utils::Uint32ToLocal(value); | 3145 return Utils::Uint32ToLocal(value); |
| 3146 } | 3146 } |
| 3147 return Local<Uint32>(); | 3147 return Local<Uint32>(); |
| 3148 } | 3148 } |
| 3149 | 3149 |
| 3150 | 3150 |
| 3151 int32_t Value::Int32Value() const { | 3151 int32_t Value::Int32Value() const { |
| 3152 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 3152 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 3153 if (obj->IsSmi()) { | 3153 if (obj->IsSmi()) { |
| 3154 return i::Smi::cast(*obj)->value(); | 3154 return i::Smi::cast(*obj)->value(); |
| 3155 } else { | 3155 } else { |
| 3156 i::Isolate* isolate = i::Isolate::Current(); | 3156 i::Isolate* isolate = i::Isolate::Current(); |
| 3157 if (IsDeadCheck(isolate, "v8::Value::Int32Value()")) return 0; | 3157 if (IsDeadCheck(isolate, "v8::Value::Int32Value()")) return 0; |
| 3158 LOG_API(isolate, "Int32Value (slow)"); | 3158 LOG_API(isolate, "Int32Value (slow)"); |
| 3159 ENTER_V8(isolate); | 3159 ENTER_V8(isolate); |
| 3160 EXCEPTION_PREAMBLE(isolate); | 3160 EXCEPTION_PREAMBLE(isolate); |
| 3161 i::Handle<i::Object> num = | 3161 i::Handle<i::Object> num = |
| 3162 i::Execution::ToInt32(obj, &has_pending_exception); | 3162 i::Execution::ToInt32(isolate, obj, &has_pending_exception); |
| 3163 EXCEPTION_BAILOUT_CHECK(isolate, 0); | 3163 EXCEPTION_BAILOUT_CHECK(isolate, 0); |
| 3164 if (num->IsSmi()) { | 3164 if (num->IsSmi()) { |
| 3165 return i::Smi::cast(*num)->value(); | 3165 return i::Smi::cast(*num)->value(); |
| 3166 } else { | 3166 } else { |
| 3167 return static_cast<int32_t>(num->Number()); | 3167 return static_cast<int32_t>(num->Number()); |
| 3168 } | 3168 } |
| 3169 } | 3169 } |
| 3170 } | 3170 } |
| 3171 | 3171 |
| 3172 | 3172 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3233 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 3233 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 3234 if (obj->IsSmi()) { | 3234 if (obj->IsSmi()) { |
| 3235 return i::Smi::cast(*obj)->value(); | 3235 return i::Smi::cast(*obj)->value(); |
| 3236 } else { | 3236 } else { |
| 3237 i::Isolate* isolate = i::Isolate::Current(); | 3237 i::Isolate* isolate = i::Isolate::Current(); |
| 3238 if (IsDeadCheck(isolate, "v8::Value::Uint32Value()")) return 0; | 3238 if (IsDeadCheck(isolate, "v8::Value::Uint32Value()")) return 0; |
| 3239 LOG_API(isolate, "Uint32Value"); | 3239 LOG_API(isolate, "Uint32Value"); |
| 3240 ENTER_V8(isolate); | 3240 ENTER_V8(isolate); |
| 3241 EXCEPTION_PREAMBLE(isolate); | 3241 EXCEPTION_PREAMBLE(isolate); |
| 3242 i::Handle<i::Object> num = | 3242 i::Handle<i::Object> num = |
| 3243 i::Execution::ToUint32(obj, &has_pending_exception); | 3243 i::Execution::ToUint32(isolate, obj, &has_pending_exception); |
| 3244 EXCEPTION_BAILOUT_CHECK(isolate, 0); | 3244 EXCEPTION_BAILOUT_CHECK(isolate, 0); |
| 3245 if (num->IsSmi()) { | 3245 if (num->IsSmi()) { |
| 3246 return i::Smi::cast(*num)->value(); | 3246 return i::Smi::cast(*num)->value(); |
| 3247 } else { | 3247 } else { |
| 3248 return static_cast<uint32_t>(num->Number()); | 3248 return static_cast<uint32_t>(num->Number()); |
| 3249 } | 3249 } |
| 3250 } | 3250 } |
| 3251 } | 3251 } |
| 3252 | 3252 |
| 3253 | 3253 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3370 PropertyAttribute v8::Object::GetPropertyAttributes(v8::Handle<Value> key) { | 3370 PropertyAttribute v8::Object::GetPropertyAttributes(v8::Handle<Value> key) { |
| 3371 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3371 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3372 ON_BAILOUT(isolate, "v8::Object::GetPropertyAttribute()", | 3372 ON_BAILOUT(isolate, "v8::Object::GetPropertyAttribute()", |
| 3373 return static_cast<PropertyAttribute>(NONE)); | 3373 return static_cast<PropertyAttribute>(NONE)); |
| 3374 ENTER_V8(isolate); | 3374 ENTER_V8(isolate); |
| 3375 i::HandleScope scope(isolate); | 3375 i::HandleScope scope(isolate); |
| 3376 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3376 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3377 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); | 3377 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); |
| 3378 if (!key_obj->IsName()) { | 3378 if (!key_obj->IsName()) { |
| 3379 EXCEPTION_PREAMBLE(isolate); | 3379 EXCEPTION_PREAMBLE(isolate); |
| 3380 key_obj = i::Execution::ToString(key_obj, &has_pending_exception); | 3380 key_obj = i::Execution::ToString(isolate, key_obj, &has_pending_exception); |
| 3381 EXCEPTION_BAILOUT_CHECK(isolate, static_cast<PropertyAttribute>(NONE)); | 3381 EXCEPTION_BAILOUT_CHECK(isolate, static_cast<PropertyAttribute>(NONE)); |
| 3382 } | 3382 } |
| 3383 i::Handle<i::Name> key_name = i::Handle<i::Name>::cast(key_obj); | 3383 i::Handle<i::Name> key_name = i::Handle<i::Name>::cast(key_obj); |
| 3384 PropertyAttributes result = self->GetPropertyAttribute(*key_name); | 3384 PropertyAttributes result = self->GetPropertyAttribute(*key_name); |
| 3385 if (result == ABSENT) return static_cast<PropertyAttribute>(NONE); | 3385 if (result == ABSENT) return static_cast<PropertyAttribute>(NONE); |
| 3386 return static_cast<PropertyAttribute>(result); | 3386 return static_cast<PropertyAttribute>(result); |
| 3387 } | 3387 } |
| 3388 | 3388 |
| 3389 | 3389 |
| 3390 Local<Value> v8::Object::GetPrototype() { | 3390 Local<Value> v8::Object::GetPrototype() { |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4072 } | 4072 } |
| 4073 | 4073 |
| 4074 | 4074 |
| 4075 bool v8::Object::IsCallable() { | 4075 bool v8::Object::IsCallable() { |
| 4076 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 4076 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 4077 ON_BAILOUT(isolate, "v8::Object::IsCallable()", return false); | 4077 ON_BAILOUT(isolate, "v8::Object::IsCallable()", return false); |
| 4078 ENTER_V8(isolate); | 4078 ENTER_V8(isolate); |
| 4079 i::HandleScope scope(isolate); | 4079 i::HandleScope scope(isolate); |
| 4080 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); | 4080 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); |
| 4081 if (obj->IsJSFunction()) return true; | 4081 if (obj->IsJSFunction()) return true; |
| 4082 return i::Execution::GetFunctionDelegate(obj)->IsJSFunction(); | 4082 return i::Execution::GetFunctionDelegate(isolate, obj)->IsJSFunction(); |
| 4083 } | 4083 } |
| 4084 | 4084 |
| 4085 | 4085 |
| 4086 Local<v8::Value> Object::CallAsFunction(v8::Handle<v8::Object> recv, | 4086 Local<v8::Value> Object::CallAsFunction(v8::Handle<v8::Object> recv, |
| 4087 int argc, | 4087 int argc, |
| 4088 v8::Handle<v8::Value> argv[]) { | 4088 v8::Handle<v8::Value> argv[]) { |
| 4089 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 4089 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 4090 ON_BAILOUT(isolate, "v8::Object::CallAsFunction()", | 4090 ON_BAILOUT(isolate, "v8::Object::CallAsFunction()", |
| 4091 return Local<v8::Value>()); | 4091 return Local<v8::Value>()); |
| 4092 LOG_API(isolate, "Object::CallAsFunction"); | 4092 LOG_API(isolate, "Object::CallAsFunction"); |
| 4093 ENTER_V8(isolate); | 4093 ENTER_V8(isolate); |
| 4094 i::Logger::TimerEventScope timer_scope( | 4094 i::Logger::TimerEventScope timer_scope( |
| 4095 isolate, i::Logger::TimerEventScope::v8_execute); | 4095 isolate, i::Logger::TimerEventScope::v8_execute); |
| 4096 i::HandleScope scope(isolate); | 4096 i::HandleScope scope(isolate); |
| 4097 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); | 4097 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); |
| 4098 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv); | 4098 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv); |
| 4099 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); | 4099 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); |
| 4100 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); | 4100 i::Handle<i::Object>* args = reinterpret_cast<i::Handle<i::Object>*>(argv); |
| 4101 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>(); | 4101 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>(); |
| 4102 if (obj->IsJSFunction()) { | 4102 if (obj->IsJSFunction()) { |
| 4103 fun = i::Handle<i::JSFunction>::cast(obj); | 4103 fun = i::Handle<i::JSFunction>::cast(obj); |
| 4104 } else { | 4104 } else { |
| 4105 EXCEPTION_PREAMBLE(isolate); | 4105 EXCEPTION_PREAMBLE(isolate); |
| 4106 i::Handle<i::Object> delegate = | 4106 i::Handle<i::Object> delegate = i::Execution::TryGetFunctionDelegate( |
| 4107 i::Execution::TryGetFunctionDelegate(obj, &has_pending_exception); | 4107 isolate, obj, &has_pending_exception); |
| 4108 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); | 4108 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); |
| 4109 fun = i::Handle<i::JSFunction>::cast(delegate); | 4109 fun = i::Handle<i::JSFunction>::cast(delegate); |
| 4110 recv_obj = obj; | 4110 recv_obj = obj; |
| 4111 } | 4111 } |
| 4112 EXCEPTION_PREAMBLE(isolate); | 4112 EXCEPTION_PREAMBLE(isolate); |
| 4113 i::Handle<i::Object> returned = | 4113 i::Handle<i::Object> returned = |
| 4114 i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception); | 4114 i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception); |
| 4115 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Value>()); | 4115 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Value>()); |
| 4116 return Utils::ToLocal(scope.CloseAndEscape(returned)); | 4116 return Utils::ToLocal(scope.CloseAndEscape(returned)); |
| 4117 } | 4117 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 4133 if (obj->IsJSFunction()) { | 4133 if (obj->IsJSFunction()) { |
| 4134 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(obj); | 4134 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(obj); |
| 4135 EXCEPTION_PREAMBLE(isolate); | 4135 EXCEPTION_PREAMBLE(isolate); |
| 4136 i::Handle<i::Object> returned = | 4136 i::Handle<i::Object> returned = |
| 4137 i::Execution::New(fun, argc, args, &has_pending_exception); | 4137 i::Execution::New(fun, argc, args, &has_pending_exception); |
| 4138 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>()); | 4138 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>()); |
| 4139 return Utils::ToLocal(scope.CloseAndEscape( | 4139 return Utils::ToLocal(scope.CloseAndEscape( |
| 4140 i::Handle<i::JSObject>::cast(returned))); | 4140 i::Handle<i::JSObject>::cast(returned))); |
| 4141 } | 4141 } |
| 4142 EXCEPTION_PREAMBLE(isolate); | 4142 EXCEPTION_PREAMBLE(isolate); |
| 4143 i::Handle<i::Object> delegate = | 4143 i::Handle<i::Object> delegate = i::Execution::TryGetConstructorDelegate( |
| 4144 i::Execution::TryGetConstructorDelegate(obj, &has_pending_exception); | 4144 isolate, obj, &has_pending_exception); |
| 4145 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); | 4145 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); |
| 4146 if (!delegate->IsUndefined()) { | 4146 if (!delegate->IsUndefined()) { |
| 4147 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(delegate); | 4147 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(delegate); |
| 4148 EXCEPTION_PREAMBLE(isolate); | 4148 EXCEPTION_PREAMBLE(isolate); |
| 4149 i::Handle<i::Object> returned = | 4149 i::Handle<i::Object> returned = |
| 4150 i::Execution::Call(fun, obj, argc, args, &has_pending_exception); | 4150 i::Execution::Call(fun, obj, argc, args, &has_pending_exception); |
| 4151 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>()); | 4151 EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<v8::Object>()); |
| 4152 ASSERT(!delegate->IsUndefined()); | 4152 ASSERT(!delegate->IsUndefined()); |
| 4153 return Utils::ToLocal(scope.CloseAndEscape(returned)); | 4153 return Utils::ToLocal(scope.CloseAndEscape(returned)); |
| 4154 } | 4154 } |
| (...skipping 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6043 i::Isolate* isolate = i::Isolate::Current(); | 6043 i::Isolate* isolate = i::Isolate::Current(); |
| 6044 EnsureInitializedForIsolate(isolate, "v8::Date::New()"); | 6044 EnsureInitializedForIsolate(isolate, "v8::Date::New()"); |
| 6045 LOG_API(isolate, "Date::New"); | 6045 LOG_API(isolate, "Date::New"); |
| 6046 if (std::isnan(time)) { | 6046 if (std::isnan(time)) { |
| 6047 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. | 6047 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. |
| 6048 time = i::OS::nan_value(); | 6048 time = i::OS::nan_value(); |
| 6049 } | 6049 } |
| 6050 ENTER_V8(isolate); | 6050 ENTER_V8(isolate); |
| 6051 EXCEPTION_PREAMBLE(isolate); | 6051 EXCEPTION_PREAMBLE(isolate); |
| 6052 i::Handle<i::Object> obj = | 6052 i::Handle<i::Object> obj = |
| 6053 i::Execution::NewDate(time, &has_pending_exception); | 6053 i::Execution::NewDate(isolate, time, &has_pending_exception); |
| 6054 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Value>()); | 6054 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Value>()); |
| 6055 return Utils::ToLocal(obj); | 6055 return Utils::ToLocal(obj); |
| 6056 } | 6056 } |
| 6057 | 6057 |
| 6058 | 6058 |
| 6059 double v8::Date::ValueOf() const { | 6059 double v8::Date::ValueOf() const { |
| 6060 i::Isolate* isolate = i::Isolate::Current(); | 6060 i::Isolate* isolate = i::Isolate::Current(); |
| 6061 if (IsDeadCheck(isolate, "v8::Date::NumberValue()")) return 0; | 6061 if (IsDeadCheck(isolate, "v8::Date::NumberValue()")) return 0; |
| 6062 LOG_API(isolate, "Date::NumberValue"); | 6062 LOG_API(isolate, "Date::NumberValue"); |
| 6063 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 6063 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| (...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7162 wait_for_connection); | 7162 wait_for_connection); |
| 7163 } | 7163 } |
| 7164 | 7164 |
| 7165 | 7165 |
| 7166 void Debug::DisableAgent() { | 7166 void Debug::DisableAgent() { |
| 7167 return i::Isolate::Current()->debugger()->StopAgent(); | 7167 return i::Isolate::Current()->debugger()->StopAgent(); |
| 7168 } | 7168 } |
| 7169 | 7169 |
| 7170 | 7170 |
| 7171 void Debug::ProcessDebugMessages() { | 7171 void Debug::ProcessDebugMessages() { |
| 7172 i::Execution::ProcessDebugMessages(true); | 7172 i::Execution::ProcessDebugMessages(i::Isolate::Current(), true); |
| 7173 } | 7173 } |
| 7174 | 7174 |
| 7175 | 7175 |
| 7176 Local<Context> Debug::GetDebugContext() { | 7176 Local<Context> Debug::GetDebugContext() { |
| 7177 i::Isolate* isolate = i::Isolate::Current(); | 7177 i::Isolate* isolate = i::Isolate::Current(); |
| 7178 EnsureInitializedForIsolate(isolate, "v8::Debug::GetDebugContext()"); | 7178 EnsureInitializedForIsolate(isolate, "v8::Debug::GetDebugContext()"); |
| 7179 ENTER_V8(isolate); | 7179 ENTER_V8(isolate); |
| 7180 return Utils::ToLocal(i::Isolate::Current()->debugger()->GetDebugContext()); | 7180 return Utils::ToLocal(i::Isolate::Current()->debugger()->GetDebugContext()); |
| 7181 } | 7181 } |
| 7182 | 7182 |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7863 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7863 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7864 Address callback_address = | 7864 Address callback_address = |
| 7865 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7865 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7866 VMState<EXTERNAL> state(isolate); | 7866 VMState<EXTERNAL> state(isolate); |
| 7867 ExternalCallbackScope call_scope(isolate, callback_address); | 7867 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7868 return callback(info); | 7868 return callback(info); |
| 7869 } | 7869 } |
| 7870 | 7870 |
| 7871 | 7871 |
| 7872 } } // namespace v8::internal | 7872 } } // namespace v8::internal |
| OLD | NEW |