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

Side by Side Diff: src/runtime/runtime-object.cc

Issue 716853003: Classes: Add support for arguments in default constructor (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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/runtime/runtime-classes.cc ('k') | test/mjsunit/harmony/classes.js » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/arguments.h" 7 #include "src/arguments.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/debug.h" 9 #include "src/debug.h"
10 #include "src/runtime/runtime.h" 10 #include "src/runtime/runtime.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 if (name->AsArrayIndex(&index)) { 235 if (name->AsArrayIndex(&index)) {
236 return JSObject::SetElement(js_object, index, value, attr, SLOPPY, false, 236 return JSObject::SetElement(js_object, index, value, attr, SLOPPY, false,
237 DEFINE_PROPERTY); 237 DEFINE_PROPERTY);
238 } else { 238 } else {
239 return JSObject::SetOwnPropertyIgnoreAttributes(js_object, name, value, 239 return JSObject::SetOwnPropertyIgnoreAttributes(js_object, name, value,
240 attr); 240 attr);
241 } 241 }
242 } 242 }
243 243
244 244
245 RUNTIME_FUNCTION(Runtime_GetPrototype) { 245 MaybeHandle<Object> Runtime::GetPrototype(Isolate* isolate,
246 HandleScope scope(isolate); 246 Handle<Object> obj) {
247 DCHECK(args.length() == 1);
248 CONVERT_ARG_HANDLE_CHECKED(Object, obj, 0);
249 // We don't expect access checks to be needed on JSProxy objects. 247 // We don't expect access checks to be needed on JSProxy objects.
250 DCHECK(!obj->IsAccessCheckNeeded() || obj->IsJSObject()); 248 DCHECK(!obj->IsAccessCheckNeeded() || obj->IsJSObject());
251 PrototypeIterator iter(isolate, obj, PrototypeIterator::START_AT_RECEIVER); 249 PrototypeIterator iter(isolate, obj, PrototypeIterator::START_AT_RECEIVER);
252 do { 250 do {
253 if (PrototypeIterator::GetCurrent(iter)->IsAccessCheckNeeded() && 251 if (PrototypeIterator::GetCurrent(iter)->IsAccessCheckNeeded() &&
254 !isolate->MayNamedAccess( 252 !isolate->MayNamedAccess(
255 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)), 253 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)),
256 isolate->factory()->proto_string(), v8::ACCESS_GET)) { 254 isolate->factory()->proto_string(), v8::ACCESS_GET)) {
257 isolate->ReportFailedAccessCheck( 255 isolate->ReportFailedAccessCheck(
258 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)), 256 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)),
259 v8::ACCESS_GET); 257 v8::ACCESS_GET);
260 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); 258 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
261 return isolate->heap()->undefined_value(); 259 return isolate->factory()->undefined_value();
262 } 260 }
263 iter.AdvanceIgnoringProxies(); 261 iter.AdvanceIgnoringProxies();
264 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { 262 if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) {
265 return *PrototypeIterator::GetCurrent(iter); 263 return PrototypeIterator::GetCurrent(iter);
266 } 264 }
267 } while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)); 265 } while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN));
268 return *PrototypeIterator::GetCurrent(iter); 266 return PrototypeIterator::GetCurrent(iter);
269 } 267 }
270 268
271 269
270 RUNTIME_FUNCTION(Runtime_GetPrototype) {
271 HandleScope scope(isolate);
272 DCHECK(args.length() == 1);
273 CONVERT_ARG_HANDLE_CHECKED(Object, obj, 0);
274 Handle<Object> result;
275 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
276 Runtime::GetPrototype(isolate, obj));
277 return *result;
278 }
279
280
272 RUNTIME_FUNCTION(Runtime_InternalSetPrototype) { 281 RUNTIME_FUNCTION(Runtime_InternalSetPrototype) {
273 HandleScope scope(isolate); 282 HandleScope scope(isolate);
274 DCHECK(args.length() == 2); 283 DCHECK(args.length() == 2);
275 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); 284 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
276 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); 285 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1);
277 DCHECK(!obj->IsAccessCheckNeeded()); 286 DCHECK(!obj->IsAccessCheckNeeded());
278 DCHECK(!obj->map()->is_observed()); 287 DCHECK(!obj->map()->is_observed());
279 Handle<Object> result; 288 Handle<Object> result;
280 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 289 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
281 isolate, result, JSObject::SetPrototype(obj, prototype, false)); 290 isolate, result, JSObject::SetPrototype(obj, prototype, false));
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 1586
1578 RUNTIME_FUNCTION(RuntimeReference_ClassOf) { 1587 RUNTIME_FUNCTION(RuntimeReference_ClassOf) {
1579 SealHandleScope shs(isolate); 1588 SealHandleScope shs(isolate);
1580 DCHECK(args.length() == 1); 1589 DCHECK(args.length() == 1);
1581 CONVERT_ARG_CHECKED(Object, obj, 0); 1590 CONVERT_ARG_CHECKED(Object, obj, 0);
1582 if (!obj->IsJSReceiver()) return isolate->heap()->null_value(); 1591 if (!obj->IsJSReceiver()) return isolate->heap()->null_value();
1583 return JSReceiver::cast(obj)->class_name(); 1592 return JSReceiver::cast(obj)->class_name();
1584 } 1593 }
1585 } 1594 }
1586 } // namespace v8::internal 1595 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime/runtime-classes.cc ('k') | test/mjsunit/harmony/classes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698