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

Side by Side Diff: src/api.cc

Issue 165044: API: added function to find instance of template in prototype chain. (Closed)
Patch Set: Extended a comment. Created 11 years, 4 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
« no previous file with comments | « include/v8.h ('k') | src/objects.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after
1921 1921
1922 Local<Value> v8::Object::GetPrototype() { 1922 Local<Value> v8::Object::GetPrototype() {
1923 ON_BAILOUT("v8::Object::GetPrototype()", return Local<v8::Value>()); 1923 ON_BAILOUT("v8::Object::GetPrototype()", return Local<v8::Value>());
1924 ENTER_V8; 1924 ENTER_V8;
1925 i::Handle<i::Object> self = Utils::OpenHandle(this); 1925 i::Handle<i::Object> self = Utils::OpenHandle(this);
1926 i::Handle<i::Object> result = i::GetPrototype(self); 1926 i::Handle<i::Object> result = i::GetPrototype(self);
1927 return Utils::ToLocal(result); 1927 return Utils::ToLocal(result);
1928 } 1928 }
1929 1929
1930 1930
1931 Local<Object> v8::Object::FindInstanceInPrototypeChain(
1932 v8::Handle<FunctionTemplate> tmpl) {
1933 ON_BAILOUT("v8::Object::FindInstanceInPrototypeChain()",
1934 return Local<v8::Object>());
1935 ENTER_V8;
1936 i::JSObject* object = *Utils::OpenHandle(this);
1937 i::FunctionTemplateInfo* tmpl_info = *Utils::OpenHandle(*tmpl);
1938 while (!object->IsInstanceOf(tmpl_info)) {
1939 i::Object* prototype = object->GetPrototype();
1940 if (!prototype->IsJSObject()) return Local<Object>();
1941 object = i::JSObject::cast(prototype);
1942 }
1943 return Utils::ToLocal(i::Handle<i::JSObject>(object));
1944 }
1945
1946
1931 Local<Array> v8::Object::GetPropertyNames() { 1947 Local<Array> v8::Object::GetPropertyNames() {
1932 ON_BAILOUT("v8::Object::GetPropertyNames()", return Local<v8::Array>()); 1948 ON_BAILOUT("v8::Object::GetPropertyNames()", return Local<v8::Array>());
1933 ENTER_V8; 1949 ENTER_V8;
1934 v8::HandleScope scope; 1950 v8::HandleScope scope;
1935 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 1951 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
1936 i::Handle<i::FixedArray> value = i::GetKeysInFixedArrayFor(self); 1952 i::Handle<i::FixedArray> value = i::GetKeysInFixedArrayFor(self);
1937 // Because we use caching to speed up enumeration it is important 1953 // Because we use caching to speed up enumeration it is important
1938 // to never change the result of the basic enumeration function so 1954 // to never change the result of the basic enumeration function so
1939 // we clone the result. 1955 // we clone the result.
1940 i::Handle<i::FixedArray> elms = i::Factory::CopyFixedArray(value); 1956 i::Handle<i::FixedArray> elms = i::Factory::CopyFixedArray(value);
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after
3619 reinterpret_cast<HandleScopeImplementer*>(storage); 3635 reinterpret_cast<HandleScopeImplementer*>(storage);
3620 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); 3636 List<void**>* blocks_of_archived_thread = thread_local->Blocks();
3621 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = 3637 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread =
3622 &thread_local->handle_scope_data_; 3638 &thread_local->handle_scope_data_;
3623 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); 3639 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread);
3624 3640
3625 return storage + ArchiveSpacePerThread(); 3641 return storage + ArchiveSpacePerThread();
3626 } 3642 }
3627 3643
3628 } } // namespace v8::internal 3644 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698