| 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 | |
| 2909 int v8::Object::GetIdentityHash() { | 2882 int v8::Object::GetIdentityHash() { |
| 2910 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2883 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 2911 ON_BAILOUT(isolate, "v8::Object::GetIdentityHash()", return 0); | 2884 ON_BAILOUT(isolate, "v8::Object::GetIdentityHash()", return 0); |
| 2912 ENTER_V8(isolate); | 2885 ENTER_V8(isolate); |
| 2913 i::HandleScope scope(isolate); | 2886 i::HandleScope scope(isolate); |
| 2914 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2887 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2915 i::Handle<i::Object> hidden_props_obj(i::GetHiddenProperties(self, true)); | 2888 i::Handle<i::Object> hidden_props_obj(i::GetHiddenProperties(self, true)); |
| 2916 if (!hidden_props_obj->IsJSObject()) { | 2889 if (!hidden_props_obj->IsJSObject()) { |
| 2917 // We failed to create hidden properties. That's a detached | 2890 // We failed to create hidden properties. That's a detached |
| 2918 // global proxy. | 2891 // global proxy. |
| (...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4195 if (!result->ToObject(&object_func)) { | 4168 if (!result->ToObject(&object_func)) { |
| 4196 return; | 4169 return; |
| 4197 } | 4170 } |
| 4198 | 4171 |
| 4199 if (object_func->IsJSFunction()) { | 4172 if (object_func->IsJSFunction()) { |
| 4200 i::Handle<i::JSFunction> func = | 4173 i::Handle<i::JSFunction> func = |
| 4201 i::Handle<i::JSFunction>(i::JSFunction::cast(object_func)); | 4174 i::Handle<i::JSFunction>(i::JSFunction::cast(object_func)); |
| 4202 | 4175 |
| 4203 // Call ResetDateCache(0 but expect no exceptions: | 4176 // Call ResetDateCache(0 but expect no exceptions: |
| 4204 bool caught_exception = false; | 4177 bool caught_exception = false; |
| 4205 i::Execution::TryCall(func, | 4178 i::Handle<i::Object> result = |
| 4206 isolate->js_builtins_object(), | 4179 i::Execution::TryCall(func, isolate->js_builtins_object(), 0, NULL, |
| 4207 0, | 4180 &caught_exception); |
| 4208 NULL, | |
| 4209 &caught_exception); | |
| 4210 } | 4181 } |
| 4211 } | 4182 } |
| 4212 | 4183 |
| 4213 | 4184 |
| 4214 static i::Handle<i::String> RegExpFlagsToString(RegExp::Flags flags) { | 4185 static i::Handle<i::String> RegExpFlagsToString(RegExp::Flags flags) { |
| 4215 char flags_buf[3]; | 4186 char flags_buf[3]; |
| 4216 int num_flags = 0; | 4187 int num_flags = 0; |
| 4217 if ((flags & RegExp::kGlobal) != 0) flags_buf[num_flags++] = 'g'; | 4188 if ((flags & RegExp::kGlobal) != 0) flags_buf[num_flags++] = 'g'; |
| 4218 if ((flags & RegExp::kMultiline) != 0) flags_buf[num_flags++] = 'm'; | 4189 if ((flags & RegExp::kMultiline) != 0) flags_buf[num_flags++] = 'm'; |
| 4219 if ((flags & RegExp::kIgnoreCase) != 0) flags_buf[num_flags++] = 'i'; | 4190 if ((flags & RegExp::kIgnoreCase) != 0) flags_buf[num_flags++] = 'i'; |
| (...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5669 | 5640 |
| 5670 | 5641 |
| 5671 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 5642 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
| 5672 HandleScopeImplementer* scope_implementer = | 5643 HandleScopeImplementer* scope_implementer = |
| 5673 reinterpret_cast<HandleScopeImplementer*>(storage); | 5644 reinterpret_cast<HandleScopeImplementer*>(storage); |
| 5674 scope_implementer->IterateThis(v); | 5645 scope_implementer->IterateThis(v); |
| 5675 return storage + ArchiveSpacePerThread(); | 5646 return storage + ArchiveSpacePerThread(); |
| 5676 } | 5647 } |
| 5677 | 5648 |
| 5678 } } // namespace v8::internal | 5649 } } // namespace v8::internal |
| OLD | NEW |