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

Side by Side Diff: src/api.cc

Issue 7912: Property enumeration (Closed)
Patch Set: Created 12 years, 2 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
OLDNEW
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 1732 matching lines...) Expand 10 before | Expand all | Expand 10 after
1743 1743
1744 1744
1745 Local<Value> v8::Object::GetPrototype() { 1745 Local<Value> v8::Object::GetPrototype() {
1746 ON_BAILOUT("v8::Object::GetPrototype()", return Local<v8::Value>()); 1746 ON_BAILOUT("v8::Object::GetPrototype()", return Local<v8::Value>());
1747 i::Handle<i::Object> self = Utils::OpenHandle(this); 1747 i::Handle<i::Object> self = Utils::OpenHandle(this);
1748 i::Handle<i::Object> result = i::GetPrototype(self); 1748 i::Handle<i::Object> result = i::GetPrototype(self);
1749 return Utils::ToLocal(result); 1749 return Utils::ToLocal(result);
1750 } 1750 }
1751 1751
1752 1752
1753 Local<Array> v8::Object::GetProperties() {
1754 ON_BAILOUT("v8::Object::GetProperties()", return Local<v8::Array>());
1755 v8::HandleScope scope;
1756 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
1757 i::Handle<i::FixedArray> value = i::GetKeysInFixedArrayFor(self);
1758 // Because we use caching to speed up enumeration it is important
1759 // to never change the result of the basic enumeration function so
1760 // we clone the result.
1761 i::Handle<i::FixedArray> elms = i::Factory::CopyFixedArray(value);
1762 i::Handle<i::JSArray> result = i::Factory::NewJSArrayWithElements(elms);
1763 return scope.Close(Utils::ToLocal(result));
1764 }
1765
1766
1753 Local<String> v8::Object::ObjectProtoToString() { 1767 Local<String> v8::Object::ObjectProtoToString() {
1754 ON_BAILOUT("v8::Object::ObjectProtoToString()", return Local<v8::String>()); 1768 ON_BAILOUT("v8::Object::ObjectProtoToString()", return Local<v8::String>());
1755 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 1769 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
1756 1770
1757 i::Handle<i::Object> name(self->class_name()); 1771 i::Handle<i::Object> name(self->class_name());
1758 1772
1759 // Native implementation of Object.prototype.toString (v8natives.js): 1773 // Native implementation of Object.prototype.toString (v8natives.js):
1760 // var c = %ClassOf(this); 1774 // var c = %ClassOf(this);
1761 // if (c === 'Arguments') c = 'Object'; 1775 // if (c === 'Arguments') c = 'Object';
1762 // return "[object " + c + "]"; 1776 // return "[object " + c + "]";
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2943 reinterpret_cast<HandleScopeImplementer*>(storage); 2957 reinterpret_cast<HandleScopeImplementer*>(storage);
2944 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); 2958 List<void**>* blocks_of_archived_thread = thread_local->Blocks();
2945 ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = 2959 ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread =
2946 &thread_local->handle_scope_data_; 2960 &thread_local->handle_scope_data_;
2947 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); 2961 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread);
2948 2962
2949 return storage + ArchiveSpacePerThread(); 2963 return storage + ArchiveSpacePerThread();
2950 } 2964 }
2951 2965
2952 } } // namespace v8::internal 2966 } } // namespace v8::internal
OLDNEW
« include/v8.h ('K') | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698