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

Side by Side Diff: src/api.cc

Issue 7129058: Add GetOwnPropertyNames method for Object in the API (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 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 | « include/v8.h ('k') | test/cctest/test-api.cc » ('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 2745 matching lines...) Expand 10 before | Expand all | Expand 10 after
2756 // Because we use caching to speed up enumeration it is important 2756 // Because we use caching to speed up enumeration it is important
2757 // to never change the result of the basic enumeration function so 2757 // to never change the result of the basic enumeration function so
2758 // we clone the result. 2758 // we clone the result.
2759 i::Handle<i::FixedArray> elms = isolate->factory()->CopyFixedArray(value); 2759 i::Handle<i::FixedArray> elms = isolate->factory()->CopyFixedArray(value);
2760 i::Handle<i::JSArray> result = 2760 i::Handle<i::JSArray> result =
2761 isolate->factory()->NewJSArrayWithElements(elms); 2761 isolate->factory()->NewJSArrayWithElements(elms);
2762 return Utils::ToLocal(scope.CloseAndEscape(result)); 2762 return Utils::ToLocal(scope.CloseAndEscape(result));
2763 } 2763 }
2764 2764
2765 2765
2766 Local<Array> v8::Object::GetOwnPropertyNames() {
2767 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2768 ON_BAILOUT(isolate, "v8::Object::GetOwnPropertyNames()",
2769 return Local<v8::Array>());
2770 ENTER_V8(isolate);
2771 i::HandleScope scope(isolate);
2772 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2773 i::Handle<i::FixedArray> value =
2774 i::GetKeysInFixedArrayFor(self, i::LOCAL_ONLY);
2775 // Because we use caching to speed up enumeration it is important
2776 // to never change the result of the basic enumeration function so
2777 // we clone the result.
2778 i::Handle<i::FixedArray> elms = isolate->factory()->CopyFixedArray(value);
2779 i::Handle<i::JSArray> result =
2780 isolate->factory()->NewJSArrayWithElements(elms);
2781 return Utils::ToLocal(scope.CloseAndEscape(result));
2782 }
2783
2784
2766 Local<String> v8::Object::ObjectProtoToString() { 2785 Local<String> v8::Object::ObjectProtoToString() {
2767 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2786 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2768 ON_BAILOUT(isolate, "v8::Object::ObjectProtoToString()", 2787 ON_BAILOUT(isolate, "v8::Object::ObjectProtoToString()",
2769 return Local<v8::String>()); 2788 return Local<v8::String>());
2770 ENTER_V8(isolate); 2789 ENTER_V8(isolate);
2771 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2790 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2772 2791
2773 i::Handle<i::Object> name(self->class_name()); 2792 i::Handle<i::Object> name(self->class_name());
2774 2793
2775 // Native implementation of Object.prototype.toString (v8natives.js): 2794 // Native implementation of Object.prototype.toString (v8natives.js):
(...skipping 3318 matching lines...) Expand 10 before | Expand all | Expand 10 after
6094 6113
6095 6114
6096 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 6115 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
6097 HandleScopeImplementer* scope_implementer = 6116 HandleScopeImplementer* scope_implementer =
6098 reinterpret_cast<HandleScopeImplementer*>(storage); 6117 reinterpret_cast<HandleScopeImplementer*>(storage);
6099 scope_implementer->IterateThis(v); 6118 scope_implementer->IterateThis(v);
6100 return storage + ArchiveSpacePerThread(); 6119 return storage + ArchiveSpacePerThread();
6101 } 6120 }
6102 6121
6103 } } // namespace v8::internal 6122 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698