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

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

Issue 1619353002: [runtime] Make sure %ForInPrepare returns the correct length. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | test/mjsunit/regress/regress-3650-2.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/factory.h" 8 #include "src/factory.h"
9 #include "src/isolate-inl.h" 9 #include "src/isolate-inl.h"
10 #include "src/objects-inl.h" 10 #include "src/objects-inl.h"
(...skipping 13 matching lines...) Expand all
24 Object* property_names = Runtime_GetPropertyNamesFast( 24 Object* property_names = Runtime_GetPropertyNamesFast(
25 1, Handle<Object>::cast(receiver).location(), isolate); 25 1, Handle<Object>::cast(receiver).location(), isolate);
26 if (isolate->has_pending_exception()) { 26 if (isolate->has_pending_exception()) {
27 return MakeTriple(property_names, nullptr, nullptr); 27 return MakeTriple(property_names, nullptr, nullptr);
28 } 28 }
29 29
30 Handle<Object> cache_type(property_names, isolate); 30 Handle<Object> cache_type(property_names, isolate);
31 Handle<FixedArray> cache_array; 31 Handle<FixedArray> cache_array;
32 int cache_length; 32 int cache_length;
33 33
34 Handle<Map> receiver_map = handle(receiver->map(), isolate);
35 if (cache_type->IsMap()) { 34 if (cache_type->IsMap()) {
36 Handle<Map> cache_type_map = 35 Handle<Map> cache_type_map = Handle<Map>::cast(cache_type);
37 handle(Handle<Map>::cast(cache_type)->map(), isolate); 36 int const enum_length = cache_type_map->EnumLength();
38 DCHECK(cache_type_map.is_identical_to(isolate->factory()->meta_map())); 37 DescriptorArray* descriptors = cache_type_map->instance_descriptors();
39 int enum_length = cache_type_map->EnumLength(); 38 if (enum_length && descriptors->HasEnumCache()) {
40 DescriptorArray* descriptors = receiver_map->instance_descriptors();
41 if (enum_length > 0 && descriptors->HasEnumCache()) {
42 cache_array = handle(descriptors->GetEnumCache(), isolate); 39 cache_array = handle(descriptors->GetEnumCache(), isolate);
43 cache_length = cache_array->length(); 40 cache_length = enum_length;
44 } else { 41 } else {
45 cache_array = isolate->factory()->empty_fixed_array(); 42 cache_array = isolate->factory()->empty_fixed_array();
46 cache_length = 0; 43 cache_length = 0;
47 } 44 }
48 } else { 45 } else {
49 cache_array = Handle<FixedArray>::cast(cache_type); 46 cache_array = Handle<FixedArray>::cast(cache_type);
50 cache_length = cache_array->length(); 47 cache_length = cache_array->length();
51 // Cache type of SMI one entails slow check. 48 // Cache type of SMI one entails slow check.
52 cache_type = Handle<Object>(Smi::FromInt(1), isolate); 49 cache_type = Handle<Object>(Smi::FromInt(1), isolate);
53 } 50 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 SealHandleScope scope(isolate); 110 SealHandleScope scope(isolate);
114 DCHECK_EQ(1, args.length()); 111 DCHECK_EQ(1, args.length());
115 CONVERT_SMI_ARG_CHECKED(index, 0); 112 CONVERT_SMI_ARG_CHECKED(index, 0);
116 DCHECK_LE(0, index); 113 DCHECK_LE(0, index);
117 DCHECK_LT(index, Smi::kMaxValue); 114 DCHECK_LT(index, Smi::kMaxValue);
118 return Smi::FromInt(index + 1); 115 return Smi::FromInt(index + 1);
119 } 116 }
120 117
121 } // namespace internal 118 } // namespace internal
122 } // namespace v8 119 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-3650-2.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698