| OLD | NEW |
| 1 // Copyright 2011 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2158 return Utils::OpenHandle(this)->IsForeign(); | 2158 return Utils::OpenHandle(this)->IsForeign(); |
| 2159 } | 2159 } |
| 2160 | 2160 |
| 2161 | 2161 |
| 2162 bool Value::IsInt32() const { | 2162 bool Value::IsInt32() const { |
| 2163 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsInt32()")) return false; | 2163 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsInt32()")) return false; |
| 2164 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2164 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 2165 if (obj->IsSmi()) return true; | 2165 if (obj->IsSmi()) return true; |
| 2166 if (obj->IsNumber()) { | 2166 if (obj->IsNumber()) { |
| 2167 double value = obj->Number(); | 2167 double value = obj->Number(); |
| 2168 static const i::DoubleRepresentation minus_zero(-0.0); |
| 2169 i::DoubleRepresentation rep(value); |
| 2170 if (rep.bits == minus_zero.bits) { |
| 2171 return false; |
| 2172 } |
| 2168 return i::FastI2D(i::FastD2I(value)) == value; | 2173 return i::FastI2D(i::FastD2I(value)) == value; |
| 2169 } | 2174 } |
| 2170 return false; | 2175 return false; |
| 2171 } | 2176 } |
| 2172 | 2177 |
| 2173 | 2178 |
| 2174 bool Value::IsUint32() const { | 2179 bool Value::IsUint32() const { |
| 2175 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsUint32()")) return false; | 2180 if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsUint32()")) return false; |
| 2176 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2181 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| 2177 if (obj->IsSmi()) return i::Smi::cast(*obj)->value() >= 0; | 2182 if (obj->IsSmi()) return i::Smi::cast(*obj)->value() >= 0; |
| 2178 if (obj->IsNumber()) { | 2183 if (obj->IsNumber()) { |
| 2179 double value = obj->Number(); | 2184 double value = obj->Number(); |
| 2185 static const i::DoubleRepresentation minus_zero(-0.0); |
| 2186 i::DoubleRepresentation rep(value); |
| 2187 if (rep.bits == minus_zero.bits) { |
| 2188 return false; |
| 2189 } |
| 2180 return i::FastUI2D(i::FastD2UI(value)) == value; | 2190 return i::FastUI2D(i::FastD2UI(value)) == value; |
| 2181 } | 2191 } |
| 2182 return false; | 2192 return false; |
| 2183 } | 2193 } |
| 2184 | 2194 |
| 2185 | 2195 |
| 2186 bool Value::IsDate() const { | 2196 bool Value::IsDate() const { |
| 2187 i::Isolate* isolate = i::Isolate::Current(); | 2197 i::Isolate* isolate = i::Isolate::Current(); |
| 2188 if (IsDeadCheck(isolate, "v8::Value::IsDate()")) return false; | 2198 if (IsDeadCheck(isolate, "v8::Value::IsDate()")) return false; |
| 2189 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2199 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2732 | 2742 |
| 2733 | 2743 |
| 2734 bool v8::Object::Set(uint32_t index, v8::Handle<Value> value) { | 2744 bool v8::Object::Set(uint32_t index, v8::Handle<Value> value) { |
| 2735 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2745 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 2736 ON_BAILOUT(isolate, "v8::Object::Set()", return false); | 2746 ON_BAILOUT(isolate, "v8::Object::Set()", return false); |
| 2737 ENTER_V8(isolate); | 2747 ENTER_V8(isolate); |
| 2738 i::HandleScope scope(isolate); | 2748 i::HandleScope scope(isolate); |
| 2739 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2749 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2740 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); | 2750 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); |
| 2741 EXCEPTION_PREAMBLE(isolate); | 2751 EXCEPTION_PREAMBLE(isolate); |
| 2742 i::Handle<i::Object> obj = i::SetElement( | 2752 i::Handle<i::Object> obj = i::JSObject::SetElement( |
| 2743 self, | 2753 self, |
| 2744 index, | 2754 index, |
| 2745 value_obj, | 2755 value_obj, |
| 2746 i::kNonStrictMode); | 2756 i::kNonStrictMode); |
| 2747 has_pending_exception = obj.is_null(); | 2757 has_pending_exception = obj.is_null(); |
| 2748 EXCEPTION_BAILOUT_CHECK(isolate, false); | 2758 EXCEPTION_BAILOUT_CHECK(isolate, false); |
| 2749 return true; | 2759 return true; |
| 2750 } | 2760 } |
| 2751 | 2761 |
| 2752 | 2762 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2838 return static_cast<PropertyAttribute>(result); | 2848 return static_cast<PropertyAttribute>(result); |
| 2839 } | 2849 } |
| 2840 | 2850 |
| 2841 | 2851 |
| 2842 Local<Value> v8::Object::GetPrototype() { | 2852 Local<Value> v8::Object::GetPrototype() { |
| 2843 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2853 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 2844 ON_BAILOUT(isolate, "v8::Object::GetPrototype()", | 2854 ON_BAILOUT(isolate, "v8::Object::GetPrototype()", |
| 2845 return Local<v8::Value>()); | 2855 return Local<v8::Value>()); |
| 2846 ENTER_V8(isolate); | 2856 ENTER_V8(isolate); |
| 2847 i::Handle<i::Object> self = Utils::OpenHandle(this); | 2857 i::Handle<i::Object> self = Utils::OpenHandle(this); |
| 2848 i::Handle<i::Object> result = i::GetPrototype(self); | 2858 i::Handle<i::Object> result(self->GetPrototype()); |
| 2849 return Utils::ToLocal(result); | 2859 return Utils::ToLocal(result); |
| 2850 } | 2860 } |
| 2851 | 2861 |
| 2852 | 2862 |
| 2853 bool v8::Object::SetPrototype(Handle<Value> value) { | 2863 bool v8::Object::SetPrototype(Handle<Value> value) { |
| 2854 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2864 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 2855 ON_BAILOUT(isolate, "v8::Object::SetPrototype()", return false); | 2865 ON_BAILOUT(isolate, "v8::Object::SetPrototype()", return false); |
| 2856 ENTER_V8(isolate); | 2866 ENTER_V8(isolate); |
| 2857 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2867 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2858 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); | 2868 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2992 } | 3002 } |
| 2993 | 3003 |
| 2994 | 3004 |
| 2995 bool v8::Object::Delete(v8::Handle<String> key) { | 3005 bool v8::Object::Delete(v8::Handle<String> key) { |
| 2996 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3006 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 2997 ON_BAILOUT(isolate, "v8::Object::Delete()", return false); | 3007 ON_BAILOUT(isolate, "v8::Object::Delete()", return false); |
| 2998 ENTER_V8(isolate); | 3008 ENTER_V8(isolate); |
| 2999 i::HandleScope scope(isolate); | 3009 i::HandleScope scope(isolate); |
| 3000 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3010 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3001 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); | 3011 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
| 3002 return i::DeleteProperty(self, key_obj)->IsTrue(); | 3012 return i::JSObject::DeleteProperty(self, key_obj)->IsTrue(); |
| 3003 } | 3013 } |
| 3004 | 3014 |
| 3005 | 3015 |
| 3006 bool v8::Object::Has(v8::Handle<String> key) { | 3016 bool v8::Object::Has(v8::Handle<String> key) { |
| 3007 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3017 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3008 ON_BAILOUT(isolate, "v8::Object::Has()", return false); | 3018 ON_BAILOUT(isolate, "v8::Object::Has()", return false); |
| 3009 ENTER_V8(isolate); | 3019 ENTER_V8(isolate); |
| 3010 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3020 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3011 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); | 3021 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
| 3012 return self->HasProperty(*key_obj); | 3022 return self->HasProperty(*key_obj); |
| 3013 } | 3023 } |
| 3014 | 3024 |
| 3015 | 3025 |
| 3016 bool v8::Object::Delete(uint32_t index) { | 3026 bool v8::Object::Delete(uint32_t index) { |
| 3017 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3027 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3018 ON_BAILOUT(isolate, "v8::Object::DeleteProperty()", | 3028 ON_BAILOUT(isolate, "v8::Object::DeleteProperty()", |
| 3019 return false); | 3029 return false); |
| 3020 ENTER_V8(isolate); | 3030 ENTER_V8(isolate); |
| 3021 HandleScope scope; | 3031 HandleScope scope; |
| 3022 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3032 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3023 return i::DeleteElement(self, index)->IsTrue(); | 3033 return i::JSObject::DeleteElement(self, index)->IsTrue(); |
| 3024 } | 3034 } |
| 3025 | 3035 |
| 3026 | 3036 |
| 3027 bool v8::Object::Has(uint32_t index) { | 3037 bool v8::Object::Has(uint32_t index) { |
| 3028 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3038 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3029 ON_BAILOUT(isolate, "v8::Object::HasProperty()", return false); | 3039 ON_BAILOUT(isolate, "v8::Object::HasProperty()", return false); |
| 3030 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3040 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3031 return self->HasElement(index); | 3041 return self->HasElement(index); |
| 3032 } | 3042 } |
| 3033 | 3043 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3218 return Utils::ToLocal(i::Handle<i::Context>(context)); | 3228 return Utils::ToLocal(i::Handle<i::Context>(context)); |
| 3219 } | 3229 } |
| 3220 | 3230 |
| 3221 | 3231 |
| 3222 int v8::Object::GetIdentityHash() { | 3232 int v8::Object::GetIdentityHash() { |
| 3223 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3233 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3224 ON_BAILOUT(isolate, "v8::Object::GetIdentityHash()", return 0); | 3234 ON_BAILOUT(isolate, "v8::Object::GetIdentityHash()", return 0); |
| 3225 ENTER_V8(isolate); | 3235 ENTER_V8(isolate); |
| 3226 i::HandleScope scope(isolate); | 3236 i::HandleScope scope(isolate); |
| 3227 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3237 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3228 return i::GetIdentityHash(self); | 3238 return i::JSObject::GetIdentityHash(self); |
| 3229 } | 3239 } |
| 3230 | 3240 |
| 3231 | 3241 |
| 3232 bool v8::Object::SetHiddenValue(v8::Handle<v8::String> key, | 3242 bool v8::Object::SetHiddenValue(v8::Handle<v8::String> key, |
| 3233 v8::Handle<v8::Value> value) { | 3243 v8::Handle<v8::Value> value) { |
| 3234 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3244 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3235 ON_BAILOUT(isolate, "v8::Object::SetHiddenValue()", return false); | 3245 ON_BAILOUT(isolate, "v8::Object::SetHiddenValue()", return false); |
| 3236 ENTER_V8(isolate); | 3246 ENTER_V8(isolate); |
| 3237 i::HandleScope scope(isolate); | 3247 i::HandleScope scope(isolate); |
| 3238 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3248 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 3239 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); | 3249 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
| 3240 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); | 3250 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); |
| 3241 i::Handle<i::Object> result = i::SetHiddenProperty(self, key_obj, value_obj); | 3251 i::Handle<i::Object> result = |
| 3252 i::JSObject::SetHiddenProperty(self, key_obj, value_obj); |
| 3242 return *result == *self; | 3253 return *result == *self; |
| 3243 } | 3254 } |
| 3244 | 3255 |
| 3245 | 3256 |
| 3246 v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Handle<v8::String> key) { | 3257 v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Handle<v8::String> key) { |
| 3247 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3258 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3248 ON_BAILOUT(isolate, "v8::Object::GetHiddenValue()", | 3259 ON_BAILOUT(isolate, "v8::Object::GetHiddenValue()", |
| 3249 return Local<v8::Value>()); | 3260 return Local<v8::Value>()); |
| 3250 ENTER_V8(isolate); | 3261 ENTER_V8(isolate); |
| 3251 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 3262 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| (...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4031 | 4042 |
| 4032 i::Heap* heap = i::Isolate::Current()->heap(); | 4043 i::Heap* heap = i::Isolate::Current()->heap(); |
| 4033 heap_statistics->set_total_heap_size(heap->CommittedMemory()); | 4044 heap_statistics->set_total_heap_size(heap->CommittedMemory()); |
| 4034 heap_statistics->set_total_heap_size_executable( | 4045 heap_statistics->set_total_heap_size_executable( |
| 4035 heap->CommittedMemoryExecutable()); | 4046 heap->CommittedMemoryExecutable()); |
| 4036 heap_statistics->set_used_heap_size(heap->SizeOfObjects()); | 4047 heap_statistics->set_used_heap_size(heap->SizeOfObjects()); |
| 4037 heap_statistics->set_heap_size_limit(heap->MaxReserved()); | 4048 heap_statistics->set_heap_size_limit(heap->MaxReserved()); |
| 4038 } | 4049 } |
| 4039 | 4050 |
| 4040 | 4051 |
| 4052 void v8::V8::VisitExternalResources(ExternalResourceVisitor* visitor) { |
| 4053 i::Isolate* isolate = i::Isolate::Current(); |
| 4054 IsDeadCheck(isolate, "v8::V8::VisitExternalResources"); |
| 4055 isolate->heap()->VisitExternalResources(visitor); |
| 4056 } |
| 4057 |
| 4058 |
| 4041 bool v8::V8::IdleNotification(int hint) { | 4059 bool v8::V8::IdleNotification(int hint) { |
| 4042 // Returning true tells the caller that it need not | 4060 // Returning true tells the caller that it need not |
| 4043 // continue to call IdleNotification. | 4061 // continue to call IdleNotification. |
| 4044 i::Isolate* isolate = i::Isolate::Current(); | 4062 i::Isolate* isolate = i::Isolate::Current(); |
| 4045 if (isolate == NULL || !isolate->IsInitialized()) return true; | 4063 if (isolate == NULL || !isolate->IsInitialized()) return true; |
| 4046 return i::V8::IdleNotification(hint); | 4064 return i::V8::IdleNotification(hint); |
| 4047 } | 4065 } |
| 4048 | 4066 |
| 4049 | 4067 |
| 4050 void v8::V8::LowMemoryNotification() { | 4068 void v8::V8::LowMemoryNotification() { |
| (...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5535 wait_for_connection); | 5553 wait_for_connection); |
| 5536 } | 5554 } |
| 5537 | 5555 |
| 5538 | 5556 |
| 5539 void Debug::DisableAgent() { | 5557 void Debug::DisableAgent() { |
| 5540 return i::Isolate::Current()->debugger()->StopAgent(); | 5558 return i::Isolate::Current()->debugger()->StopAgent(); |
| 5541 } | 5559 } |
| 5542 | 5560 |
| 5543 | 5561 |
| 5544 void Debug::ProcessDebugMessages() { | 5562 void Debug::ProcessDebugMessages() { |
| 5545 i::Execution::ProcessDebugMesssages(true); | 5563 i::Execution::ProcessDebugMessages(true); |
| 5546 } | 5564 } |
| 5547 | 5565 |
| 5548 Local<Context> Debug::GetDebugContext() { | 5566 Local<Context> Debug::GetDebugContext() { |
| 5549 i::Isolate* isolate = i::Isolate::Current(); | 5567 i::Isolate* isolate = i::Isolate::Current(); |
| 5550 EnsureInitializedForIsolate(isolate, "v8::Debug::GetDebugContext()"); | 5568 EnsureInitializedForIsolate(isolate, "v8::Debug::GetDebugContext()"); |
| 5551 ENTER_V8(isolate); | 5569 ENTER_V8(isolate); |
| 5552 return Utils::ToLocal(i::Isolate::Current()->debugger()->GetDebugContext()); | 5570 return Utils::ToLocal(i::Isolate::Current()->debugger()->GetDebugContext()); |
| 5553 } | 5571 } |
| 5554 | 5572 |
| 5555 #endif // ENABLE_DEBUGGER_SUPPORT | 5573 #endif // ENABLE_DEBUGGER_SUPPORT |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6147 | 6165 |
| 6148 | 6166 |
| 6149 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 6167 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
| 6150 HandleScopeImplementer* scope_implementer = | 6168 HandleScopeImplementer* scope_implementer = |
| 6151 reinterpret_cast<HandleScopeImplementer*>(storage); | 6169 reinterpret_cast<HandleScopeImplementer*>(storage); |
| 6152 scope_implementer->IterateThis(v); | 6170 scope_implementer->IterateThis(v); |
| 6153 return storage + ArchiveSpacePerThread(); | 6171 return storage + ArchiveSpacePerThread(); |
| 6154 } | 6172 } |
| 6155 | 6173 |
| 6156 } } // namespace v8::internal | 6174 } } // namespace v8::internal |
| OLD | NEW |