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

Unified Diff: src/objects.cc

Issue 1994183002: [json] handle proxies in BasicJsonSerializer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: address comments Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | test/mjsunit/es6/proxies-json.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 3c23e011fc6285453934decd98e884a1f10db89a..3a33996b1bd373be11df8824d1e180a91d230efb 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -719,14 +719,9 @@ MaybeHandle<FixedArray> Object::CreateListFromArrayLike(
}
// 4. Let len be ? ToLength(? Get(obj, "length")).
Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(object);
- Handle<Object> raw_length_obj;
- ASSIGN_RETURN_ON_EXCEPTION(
- isolate, raw_length_obj,
- JSReceiver::GetProperty(receiver, isolate->factory()->length_string()),
- FixedArray);
Handle<Object> raw_length_number;
ASSIGN_RETURN_ON_EXCEPTION(isolate, raw_length_number,
- Object::ToLength(isolate, raw_length_obj),
+ Object::GetLengthFromArrayLike(isolate, receiver),
FixedArray);
uint32_t len;
if (!raw_length_number->ToUint32(&len) ||
@@ -773,6 +768,16 @@ MaybeHandle<FixedArray> Object::CreateListFromArrayLike(
// static
+MaybeHandle<Object> Object::GetLengthFromArrayLike(Isolate* isolate,
+ Handle<Object> object) {
+ Handle<Object> val;
+ Handle<Object> key = isolate->factory()->length_string();
+ ASSIGN_RETURN_ON_EXCEPTION(
+ isolate, val, Runtime::GetObjectProperty(isolate, object, key), Object);
+ return Object::ToLength(isolate, val);
+}
+
+// static
Maybe<bool> JSReceiver::HasProperty(LookupIterator* it) {
for (; it->IsFound(); it->Next()) {
switch (it->state()) {
« no previous file with comments | « src/objects.h ('k') | test/mjsunit/es6/proxies-json.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698