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

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

Issue 1865013002: Quit creating array literal boilerplates from Crankshaft. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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
« src/runtime/runtime.h ('K') | « src/runtime/runtime.h ('k') | no next file » | 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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // computed properties have been assigned so that we can generate 102 // computed properties have been assigned so that we can generate
103 // constant function properties. 103 // constant function properties.
104 if (should_transform) { 104 if (should_transform) {
105 JSObject::MigrateSlowToFast(boilerplate, 105 JSObject::MigrateSlowToFast(boilerplate,
106 boilerplate->map()->unused_property_fields(), 106 boilerplate->map()->unused_property_fields(),
107 "FastLiteral"); 107 "FastLiteral");
108 } 108 }
109 return boilerplate; 109 return boilerplate;
110 } 110 }
111 111
112 MaybeHandle<Object> Runtime::CreateArrayLiteralBoilerplate( 112 static MaybeHandle<Object> CreateArrayLiteralBoilerplate(
113 Isolate* isolate, Handle<LiteralsArray> literals, 113 Isolate* isolate, Handle<LiteralsArray> literals,
114 Handle<FixedArray> elements) { 114 Handle<FixedArray> elements) {
115 // Create the JSArray. 115 // Create the JSArray.
116 Handle<JSFunction> constructor = isolate->array_function(); 116 Handle<JSFunction> constructor = isolate->array_function();
117 117
118 PretenureFlag pretenure_flag = 118 PretenureFlag pretenure_flag =
119 isolate->heap()->InNewSpace(*literals) ? NOT_TENURED : TENURED; 119 isolate->heap()->InNewSpace(*literals) ? NOT_TENURED : TENURED;
120 120
121 Handle<JSArray> object = Handle<JSArray>::cast( 121 Handle<JSArray> object = Handle<JSArray>::cast(
122 isolate->factory()->NewJSObject(constructor, pretenure_flag)); 122 isolate->factory()->NewJSObject(constructor, pretenure_flag));
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 MUST_USE_RESULT static MaybeHandle<Object> CreateLiteralBoilerplate( 184 MUST_USE_RESULT static MaybeHandle<Object> CreateLiteralBoilerplate(
185 Isolate* isolate, Handle<LiteralsArray> literals, 185 Isolate* isolate, Handle<LiteralsArray> literals,
186 Handle<FixedArray> array) { 186 Handle<FixedArray> array) {
187 Handle<FixedArray> elements = CompileTimeValue::GetElements(array); 187 Handle<FixedArray> elements = CompileTimeValue::GetElements(array);
188 switch (CompileTimeValue::GetLiteralType(array)) { 188 switch (CompileTimeValue::GetLiteralType(array)) {
189 case CompileTimeValue::OBJECT_LITERAL_FAST_ELEMENTS: 189 case CompileTimeValue::OBJECT_LITERAL_FAST_ELEMENTS:
190 return CreateObjectLiteralBoilerplate(isolate, literals, elements, true); 190 return CreateObjectLiteralBoilerplate(isolate, literals, elements, true);
191 case CompileTimeValue::OBJECT_LITERAL_SLOW_ELEMENTS: 191 case CompileTimeValue::OBJECT_LITERAL_SLOW_ELEMENTS:
192 return CreateObjectLiteralBoilerplate(isolate, literals, elements, false); 192 return CreateObjectLiteralBoilerplate(isolate, literals, elements, false);
193 case CompileTimeValue::ARRAY_LITERAL: 193 case CompileTimeValue::ARRAY_LITERAL:
194 return Runtime::CreateArrayLiteralBoilerplate(isolate, literals, 194 return CreateArrayLiteralBoilerplate(isolate, literals, elements);
195 elements);
196 default: 195 default:
197 UNREACHABLE(); 196 UNREACHABLE();
198 return MaybeHandle<Object>(); 197 return MaybeHandle<Object>();
199 } 198 }
200 } 199 }
201 200
202 201
203 RUNTIME_FUNCTION(Runtime_CreateRegExpLiteral) { 202 RUNTIME_FUNCTION(Runtime_CreateRegExpLiteral) {
204 HandleScope scope(isolate); 203 HandleScope scope(isolate);
205 DCHECK_EQ(4, args.length()); 204 DCHECK_EQ(4, args.length());
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 Isolate* isolate, Handle<LiteralsArray> literals, int literals_index, 272 Isolate* isolate, Handle<LiteralsArray> literals, int literals_index,
274 Handle<FixedArray> elements) { 273 Handle<FixedArray> elements) {
275 // Check if boilerplate exists. If not, create it first. 274 // Check if boilerplate exists. If not, create it first.
276 Handle<Object> literal_site(literals->literal(literals_index), isolate); 275 Handle<Object> literal_site(literals->literal(literals_index), isolate);
277 Handle<AllocationSite> site; 276 Handle<AllocationSite> site;
278 if (*literal_site == isolate->heap()->undefined_value()) { 277 if (*literal_site == isolate->heap()->undefined_value()) {
279 DCHECK(*elements != isolate->heap()->empty_fixed_array()); 278 DCHECK(*elements != isolate->heap()->empty_fixed_array());
280 Handle<Object> boilerplate; 279 Handle<Object> boilerplate;
281 ASSIGN_RETURN_ON_EXCEPTION( 280 ASSIGN_RETURN_ON_EXCEPTION(
282 isolate, boilerplate, 281 isolate, boilerplate,
283 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements), 282 CreateArrayLiteralBoilerplate(isolate, literals, elements),
284 AllocationSite); 283 AllocationSite);
285 284
286 AllocationSiteCreationContext creation_context(isolate); 285 AllocationSiteCreationContext creation_context(isolate);
287 site = creation_context.EnterNewScope(); 286 site = creation_context.EnterNewScope();
288 if (JSObject::DeepWalk(Handle<JSObject>::cast(boilerplate), 287 if (JSObject::DeepWalk(Handle<JSObject>::cast(boilerplate),
289 &creation_context).is_null()) { 288 &creation_context).is_null()) {
290 return Handle<AllocationSite>::null(); 289 return Handle<AllocationSite>::null();
291 } 290 }
292 creation_context.ExitScope(site, Handle<JSObject>::cast(boilerplate)); 291 creation_context.ExitScope(site, Handle<JSObject>::cast(boilerplate));
293 292
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 Handle<LiteralsArray> literals(closure->literals(), isolate); 353 Handle<LiteralsArray> literals(closure->literals(), isolate);
355 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 354 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
356 isolate, result, 355 isolate, result,
357 CreateArrayLiteralImpl(isolate, literals, literals_index, elements, 356 CreateArrayLiteralImpl(isolate, literals, literals_index, elements,
358 ArrayLiteral::kShallowElements)); 357 ArrayLiteral::kShallowElements));
359 return *result; 358 return *result;
360 } 359 }
361 360
362 } // namespace internal 361 } // namespace internal
363 } // namespace v8 362 } // namespace v8
OLDNEW
« src/runtime/runtime.h ('K') | « src/runtime/runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698