OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3279 recv_obj = obj; | 3279 recv_obj = obj; |
3280 } | 3280 } |
3281 EXCEPTION_PREAMBLE(isolate); | 3281 EXCEPTION_PREAMBLE(isolate); |
3282 i::Handle<i::Object> returned = | 3282 i::Handle<i::Object> returned = |
3283 i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception); | 3283 i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception); |
3284 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); | 3284 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); |
3285 return scope.Close(Utils::ToLocal(returned)); | 3285 return scope.Close(Utils::ToLocal(returned)); |
3286 } | 3286 } |
3287 | 3287 |
3288 | 3288 |
3289 Local<v8::Object> Object::CallAsConstructor( | |
3290 int argc, | |
3291 v8::Handle<v8::Value> argv[]) const { | |
3292 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | |
3293 ON_BAILOUT(isolate, "v8::Object::CallAsConstructor()", | |
3294 return Local<v8::Object>()); | |
3295 LOG_API(isolate, "Object::CallAsConstructor"); | |
3296 ENTER_V8(isolate); | |
3297 HandleScope scope; | |
Mads Ager (chromium)
2011/05/05 09:03:33
Use the isolate here.
| |
3298 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); | |
3299 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); | |
3300 i::Object*** args = reinterpret_cast<i::Object***>(argv); | |
3301 i::Handle<i::Object> returned; | |
3302 i::Handle<i::JSFunction> fun; | |
3303 EXCEPTION_PREAMBLE(isolate); | |
3304 if (obj->IsJSFunction()) { | |
3305 fun = i::Handle<i::JSFunction>::cast(obj); | |
3306 returned = i::Execution::New(fun, argc, args, &has_pending_exception); | |
3307 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); | |
3308 } else { | |
3309 i::Handle<i::Object> delegate = | |
3310 i::Execution::TryGetConstructorDelegate(obj, &has_pending_exception); | |
3311 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); | |
3312 fun = i::Handle<i::JSFunction>::cast(delegate); | |
3313 returned = | |
3314 i::Execution::Call(fun, obj, argc, args, &has_pending_exception); | |
3315 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); | |
3316 } | |
3317 return scope.Close(Utils::ToLocal(i::Handle<i::JSObject>::cast(returned))); | |
Mads Ager (chromium)
2011/05/05 09:03:33
Let's remove the cast to JSObject here. The functi
| |
3318 } | |
3319 | |
3320 | |
3289 Local<v8::Object> Function::NewInstance() const { | 3321 Local<v8::Object> Function::NewInstance() const { |
3290 return NewInstance(0, NULL); | 3322 return NewInstance(0, NULL); |
3291 } | 3323 } |
3292 | 3324 |
3293 | 3325 |
3294 Local<v8::Object> Function::NewInstance(int argc, | 3326 Local<v8::Object> Function::NewInstance(int argc, |
3295 v8::Handle<v8::Value> argv[]) const { | 3327 v8::Handle<v8::Value> argv[]) const { |
3296 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3328 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
3297 ON_BAILOUT(isolate, "v8::Function::NewInstance()", | 3329 ON_BAILOUT(isolate, "v8::Function::NewInstance()", |
3298 return Local<v8::Object>()); | 3330 return Local<v8::Object>()); |
(...skipping 2493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5792 | 5824 |
5793 | 5825 |
5794 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 5826 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
5795 HandleScopeImplementer* scope_implementer = | 5827 HandleScopeImplementer* scope_implementer = |
5796 reinterpret_cast<HandleScopeImplementer*>(storage); | 5828 reinterpret_cast<HandleScopeImplementer*>(storage); |
5797 scope_implementer->IterateThis(v); | 5829 scope_implementer->IterateThis(v); |
5798 return storage + ArchiveSpacePerThread(); | 5830 return storage + ArchiveSpacePerThread(); |
5799 } | 5831 } |
5800 | 5832 |
5801 } } // namespace v8::internal | 5833 } } // namespace v8::internal |
OLD | NEW |