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

Side by Side Diff: src/accessors.cc

Issue 342453002: Arguments object has @@iterator (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased, adapted to getdataproperty change Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/accessors.h ('k') | src/bootstrapper.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/contexts.h" 10 #include "src/contexts.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // properties. 149 // properties.
150 if (!object->map()->is_extensible()) return true; 150 if (!object->map()->is_extensible()) return true;
151 JSObject::SetOwnPropertyIgnoreAttributes(object, Utils::OpenHandle(*name), 151 JSObject::SetOwnPropertyIgnoreAttributes(object, Utils::OpenHandle(*name),
152 value, NONE).Check(); 152 value, NONE).Check();
153 } 153 }
154 return true; 154 return true;
155 } 155 }
156 156
157 157
158 // 158 //
159 // Accessors::ArgumentsIterator
160 //
161
162
163 void Accessors::ArgumentsIteratorGetter(
164 v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
165 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
166 DisallowHeapAllocation no_allocation;
167 HandleScope scope(isolate);
168 Object* result = isolate->native_context()->array_values_iterator();
169 info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(result, isolate)));
170 }
171
172
173 void Accessors::ArgumentsIteratorSetter(
174 v8::Local<v8::Name> name, v8::Local<v8::Value> val,
175 const v8::PropertyCallbackInfo<void>& info) {
176 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
177 HandleScope scope(isolate);
178 Handle<JSObject> object = Utils::OpenHandle(*info.This());
179 Handle<Object> value = Utils::OpenHandle(*val);
180
181 if (SetPropertyOnInstanceIfInherited(isolate, info, name, value)) return;
182
183 LookupIterator it(object, Utils::OpenHandle(*name));
184 CHECK(it.HasProperty());
185 DCHECK(it.HolderIsReceiverOrHiddenPrototype());
186 Object::SetDataProperty(&it, value);
187 }
188
189
190 Handle<AccessorInfo> Accessors::ArgumentsIteratorInfo(
191 Isolate* isolate, PropertyAttributes attributes) {
192 Handle<Name> name(isolate->native_context()->iterator_symbol(), isolate);
193 return MakeAccessor(isolate, name, &ArgumentsIteratorGetter,
194 &ArgumentsIteratorSetter, attributes);
195 }
196
197
198 //
159 // Accessors::ArrayLength 199 // Accessors::ArrayLength
160 // 200 //
161 201
162 202
163 // The helper function will 'flatten' Number objects. 203 // The helper function will 'flatten' Number objects.
164 Handle<Object> Accessors::FlattenNumber(Isolate* isolate, 204 Handle<Object> Accessors::FlattenNumber(Isolate* isolate,
165 Handle<Object> value) { 205 Handle<Object> value) {
166 if (value->IsNumber() || !value->IsJSValue()) return value; 206 if (value->IsNumber() || !value->IsJSValue()) return value;
167 Handle<JSValue> wrapper = Handle<JSValue>::cast(value); 207 Handle<JSValue> wrapper = Handle<JSValue>::cast(value);
168 DCHECK(wrapper->GetIsolate()->native_context()->number_function()-> 208 DCHECK(wrapper->GetIsolate()->native_context()->number_function()->
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 info->set_data(Smi::FromInt(index)); 1394 info->set_data(Smi::FromInt(index));
1355 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); 1395 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport);
1356 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); 1396 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport);
1357 info->set_getter(*getter); 1397 info->set_getter(*getter);
1358 if (!(attributes & ReadOnly)) info->set_setter(*setter); 1398 if (!(attributes & ReadOnly)) info->set_setter(*setter);
1359 return info; 1399 return info;
1360 } 1400 }
1361 1401
1362 1402
1363 } } // namespace v8::internal 1403 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/accessors.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698