| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 2861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2872 ENTER_V8(isolate); | 2872 ENTER_V8(isolate); |
| 2873 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2873 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2874 EXCEPTION_PREAMBLE(isolate); | 2874 EXCEPTION_PREAMBLE(isolate); |
| 2875 i::Handle<i::JSObject> result = i::Copy(self); | 2875 i::Handle<i::JSObject> result = i::Copy(self); |
| 2876 has_pending_exception = result.is_null(); | 2876 has_pending_exception = result.is_null(); |
| 2877 EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>()); | 2877 EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>()); |
| 2878 return Utils::ToLocal(result); | 2878 return Utils::ToLocal(result); |
| 2879 } | 2879 } |
| 2880 | 2880 |
| 2881 | 2881 |
| 2882 static i::Context* GetCreationContext(i::JSObject* object) { |
| 2883 i::Object* constructor = object->map()->constructor(); |
| 2884 i::JSFunction* function; |
| 2885 if (!constructor->IsJSFunction()) { |
| 2886 // API functions have null as a constructor, |
| 2887 // but any JSFunction knows its context immediately. |
| 2888 ASSERT(object->IsJSFunction() && |
| 2889 i::JSFunction::cast(object)->shared()->IsApiFunction()); |
| 2890 function = i::JSFunction::cast(object); |
| 2891 } else { |
| 2892 function = i::JSFunction::cast(constructor); |
| 2893 } |
| 2894 return function->context()->global_context(); |
| 2895 } |
| 2896 |
| 2897 |
| 2898 Local<v8::Context> v8::Object::CreationContext() { |
| 2899 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 2900 ON_BAILOUT(isolate, |
| 2901 "v8::Object::CreationContext()", return Local<v8::Context>()); |
| 2902 ENTER_V8(isolate); |
| 2903 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2904 i::Context* context = GetCreationContext(*self); |
| 2905 return Utils::ToLocal(i::Handle<i::Context>(context)); |
| 2906 } |
| 2907 |
| 2908 |
| 2882 int v8::Object::GetIdentityHash() { | 2909 int v8::Object::GetIdentityHash() { |
| 2883 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2910 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 2884 ON_BAILOUT(isolate, "v8::Object::GetIdentityHash()", return 0); | 2911 ON_BAILOUT(isolate, "v8::Object::GetIdentityHash()", return 0); |
| 2885 ENTER_V8(isolate); | 2912 ENTER_V8(isolate); |
| 2886 i::HandleScope scope(isolate); | 2913 i::HandleScope scope(isolate); |
| 2887 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2914 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2888 i::Handle<i::Object> hidden_props_obj(i::GetHiddenProperties(self, true)); | 2915 i::Handle<i::Object> hidden_props_obj(i::GetHiddenProperties(self, true)); |
| 2889 if (!hidden_props_obj->IsJSObject()) { | 2916 if (!hidden_props_obj->IsJSObject()) { |
| 2890 // We failed to create hidden properties. That's a detached | 2917 // We failed to create hidden properties. That's a detached |
| 2891 // global proxy. | 2918 // global proxy. |
| (...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4168 if (!result->ToObject(&object_func)) { | 4195 if (!result->ToObject(&object_func)) { |
| 4169 return; | 4196 return; |
| 4170 } | 4197 } |
| 4171 | 4198 |
| 4172 if (object_func->IsJSFunction()) { | 4199 if (object_func->IsJSFunction()) { |
| 4173 i::Handle<i::JSFunction> func = | 4200 i::Handle<i::JSFunction> func = |
| 4174 i::Handle<i::JSFunction>(i::JSFunction::cast(object_func)); | 4201 i::Handle<i::JSFunction>(i::JSFunction::cast(object_func)); |
| 4175 | 4202 |
| 4176 // Call ResetDateCache(0 but expect no exceptions: | 4203 // Call ResetDateCache(0 but expect no exceptions: |
| 4177 bool caught_exception = false; | 4204 bool caught_exception = false; |
| 4178 i::Handle<i::Object> result = | 4205 i::Execution::TryCall(func, |
| 4179 i::Execution::TryCall(func, isolate->js_builtins_object(), 0, NULL, | 4206 isolate->js_builtins_object(), |
| 4180 &caught_exception); | 4207 0, |
| 4208 NULL, |
| 4209 &caught_exception); |
| 4181 } | 4210 } |
| 4182 } | 4211 } |
| 4183 | 4212 |
| 4184 | 4213 |
| 4185 static i::Handle<i::String> RegExpFlagsToString(RegExp::Flags flags) { | 4214 static i::Handle<i::String> RegExpFlagsToString(RegExp::Flags flags) { |
| 4186 char flags_buf[3]; | 4215 char flags_buf[3]; |
| 4187 int num_flags = 0; | 4216 int num_flags = 0; |
| 4188 if ((flags & RegExp::kGlobal) != 0) flags_buf[num_flags++] = 'g'; | 4217 if ((flags & RegExp::kGlobal) != 0) flags_buf[num_flags++] = 'g'; |
| 4189 if ((flags & RegExp::kMultiline) != 0) flags_buf[num_flags++] = 'm'; | 4218 if ((flags & RegExp::kMultiline) != 0) flags_buf[num_flags++] = 'm'; |
| 4190 if ((flags & RegExp::kIgnoreCase) != 0) flags_buf[num_flags++] = 'i'; | 4219 if ((flags & RegExp::kIgnoreCase) != 0) flags_buf[num_flags++] = 'i'; |
| (...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5640 | 5669 |
| 5641 | 5670 |
| 5642 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 5671 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
| 5643 HandleScopeImplementer* scope_implementer = | 5672 HandleScopeImplementer* scope_implementer = |
| 5644 reinterpret_cast<HandleScopeImplementer*>(storage); | 5673 reinterpret_cast<HandleScopeImplementer*>(storage); |
| 5645 scope_implementer->IterateThis(v); | 5674 scope_implementer->IterateThis(v); |
| 5646 return storage + ArchiveSpacePerThread(); | 5675 return storage + ArchiveSpacePerThread(); |
| 5647 } | 5676 } |
| 5648 | 5677 |
| 5649 } } // namespace v8::internal | 5678 } } // namespace v8::internal |
| OLD | NEW |