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

Side by Side Diff: src/builtins.cc

Issue 1392203002: [es6] Support optional "receiver" argument in Reflect.get. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Be strict again. Created 5 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
« no previous file with comments | « src/bootstrapper.cc ('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 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/builtins.h" 5 #include "src/builtins.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 isolate, result, JSReceiver::DeletePropertyOrElement( 1467 isolate, result, JSReceiver::DeletePropertyOrElement(
1468 Handle<JSReceiver>::cast(target), name)); 1468 Handle<JSReceiver>::cast(target), name));
1469 1469
1470 return *result; 1470 return *result;
1471 } 1471 }
1472 1472
1473 1473
1474 // ES6 section 26.1.6 Reflect.get 1474 // ES6 section 26.1.6 Reflect.get
1475 BUILTIN(ReflectGet) { 1475 BUILTIN(ReflectGet) {
1476 HandleScope scope(isolate); 1476 HandleScope scope(isolate);
1477 DCHECK_LE(3, args.length()); 1477 Handle<Object> undef = isolate->factory()->undefined_value();
1478 DCHECK_LE(args.length(), 4); 1478 Handle<Object> target = args.length() > 1 ? args.at<Object>(1) : undef;
1479 Handle<Object> target = args.at<Object>(1); 1479 Handle<Object> key = args.length() > 2 ? args.at<Object>(2) : undef;
1480 Handle<Object> key = args.at<Object>(2); 1480 Handle<Object> receiver = args.length() > 3 ? args.at<Object>(3) : target;
1481 // Handle<Object> receiver = args.length() == 4 ? args.at<Object>(3) : target;
1482 //
1483 // TODO(neis): We ignore the receiver argument for now because
1484 // GetPropertyOrElement doesn't support it yet.
1485 1481
1486 if (!target->IsJSReceiver()) { 1482 if (!target->IsJSReceiver()) {
1487 THROW_NEW_ERROR_RETURN_FAILURE( 1483 THROW_NEW_ERROR_RETURN_FAILURE(
1488 isolate, NewTypeError(MessageTemplate::kCalledOnNonObject, 1484 isolate, NewTypeError(MessageTemplate::kCalledOnNonObject,
1489 isolate->factory()->NewStringFromAsciiChecked( 1485 isolate->factory()->NewStringFromAsciiChecked(
1490 "Reflect.get"))); 1486 "Reflect.get")));
1491 } 1487 }
1492 1488
1493 Handle<Name> name; 1489 Handle<Name> name;
1494 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name, 1490 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name,
1495 Object::ToName(isolate, key)); 1491 Object::ToName(isolate, key));
1496 1492
1497 Handle<Object> result; 1493 Handle<Object> result;
1498 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1494 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1499 isolate, result, Object::GetPropertyOrElement(target, name)); 1495 isolate, result, Object::GetPropertyOrElement(
1496 Handle<JSReceiver>::cast(target), name, receiver));
1500 1497
1501 return *result; 1498 return *result;
1502 } 1499 }
1503 1500
1504 1501
1505 // ES6 section 26.1.9 Reflect.has 1502 // ES6 section 26.1.9 Reflect.has
1506 BUILTIN(ReflectHas) { 1503 BUILTIN(ReflectHas) {
1507 HandleScope scope(isolate); 1504 HandleScope scope(isolate);
1508 DCHECK_EQ(3, args.length()); 1505 DCHECK_EQ(3, args.length());
1509 Handle<Object> target = args.at<Object>(1); 1506 Handle<Object> target = args.at<Object>(1);
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
2202 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 2199 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
2203 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 2200 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
2204 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 2201 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
2205 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 2202 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
2206 #undef DEFINE_BUILTIN_ACCESSOR_C 2203 #undef DEFINE_BUILTIN_ACCESSOR_C
2207 #undef DEFINE_BUILTIN_ACCESSOR_A 2204 #undef DEFINE_BUILTIN_ACCESSOR_A
2208 2205
2209 2206
2210 } // namespace internal 2207 } // namespace internal
2211 } // namespace v8 2208 } // namespace v8
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698