Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1034)

Side by Side Diff: src/api.cc

Issue 6927009: Actually revert "Add Call method to the Object class in the API" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/api.h ('k') | src/execution.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3237 matching lines...) Expand 10 before | Expand all | Expand 10 after
3248 "v8::GetIndexedPropertiesExternalArrayDataLength()", 3248 "v8::GetIndexedPropertiesExternalArrayDataLength()",
3249 return 0); 3249 return 0);
3250 if (self->HasExternalArrayElements()) { 3250 if (self->HasExternalArrayElements()) {
3251 return i::ExternalArray::cast(self->elements())->length(); 3251 return i::ExternalArray::cast(self->elements())->length();
3252 } else { 3252 } else {
3253 return -1; 3253 return -1;
3254 } 3254 }
3255 } 3255 }
3256 3256
3257 3257
3258 Local<v8::Value> Object::CallAsFunction(v8::Handle<v8::Object> recv, int argc,
3259 v8::Handle<v8::Value> argv[]) {
3260 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3261 ON_BAILOUT(isolate, "v8::Object::CallAsFunction()",
3262 return Local<v8::Value>());
3263 LOG_API(isolate, "Object::CallAsFunction");
3264 ENTER_V8(isolate);
3265 HandleScope scope;
3266 i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
3267 i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv);
3268 STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
3269 i::Object*** args = reinterpret_cast<i::Object***>(argv);
3270 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>();
3271 if (obj->IsJSFunction()) {
3272 fun = i::Handle<i::JSFunction>::cast(obj);
3273 } else {
3274 EXCEPTION_PREAMBLE(isolate);
3275 i::Handle<i::Object> delegate =
3276 i::Execution::TryGetFunctionDelegate(obj, &has_pending_exception);
3277 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
3278 fun = i::Handle<i::JSFunction>::cast(delegate);
3279 recv_obj = obj;
3280 }
3281 EXCEPTION_PREAMBLE(isolate);
3282 i::Handle<i::Object> returned =
3283 i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception);
3284 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
3285 return scope.Close(Utils::ToLocal(i::Handle<i::JSObject>::cast(returned)));
3286 }
3287
3288
3289 Local<v8::Object> Function::NewInstance() const { 3258 Local<v8::Object> Function::NewInstance() const {
3290 return NewInstance(0, NULL); 3259 return NewInstance(0, NULL);
3291 } 3260 }
3292 3261
3293 3262
3294 Local<v8::Object> Function::NewInstance(int argc, 3263 Local<v8::Object> Function::NewInstance(int argc,
3295 v8::Handle<v8::Value> argv[]) const { 3264 v8::Handle<v8::Value> argv[]) const {
3296 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3265 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3297 ON_BAILOUT(isolate, "v8::Function::NewInstance()", 3266 ON_BAILOUT(isolate, "v8::Function::NewInstance()",
3298 return Local<v8::Object>()); 3267 return Local<v8::Object>());
(...skipping 2493 matching lines...) Expand 10 before | Expand all | Expand 10 after
5792 5761
5793 5762
5794 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 5763 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
5795 HandleScopeImplementer* scope_implementer = 5764 HandleScopeImplementer* scope_implementer =
5796 reinterpret_cast<HandleScopeImplementer*>(storage); 5765 reinterpret_cast<HandleScopeImplementer*>(storage);
5797 scope_implementer->IterateThis(v); 5766 scope_implementer->IterateThis(v);
5798 return storage + ArchiveSpacePerThread(); 5767 return storage + ArchiveSpacePerThread();
5799 } 5768 }
5800 5769
5801 } } // namespace v8::internal 5770 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.h ('k') | src/execution.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698