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

Side by Side Diff: src/builtins/builtins-constructor-gen.cc

Issue 2861983002: [ignition] Optimize JSGenerator creation (Closed)
Patch Set: rebase Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/builtins/builtins-definitions.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/builtins-constructor-gen.h" 5 #include "src/builtins/builtins-constructor-gen.h"
6 6
7 #include "src/ast/ast.h" 7 #include "src/ast/ast.h"
8 #include "src/builtins/builtins-constructor.h" 8 #include "src/builtins/builtins-constructor.h"
9 #include "src/builtins/builtins-utils-gen.h" 9 #include "src/builtins/builtins-utils-gen.h"
10 #include "src/builtins/builtins.h" 10 #include "src/builtins/builtins.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 BIND(&allocate_properties); 275 BIND(&allocate_properties);
276 { 276 {
277 properties.Bind(AllocateNameDictionary(NameDictionary::kInitialCapacity)); 277 properties.Bind(AllocateNameDictionary(NameDictionary::kInitialCapacity));
278 Goto(&instantiate_map); 278 Goto(&instantiate_map);
279 } 279 }
280 280
281 BIND(&instantiate_map); 281 BIND(&instantiate_map);
282 282
283 Node* object = AllocateJSObjectFromMap(initial_map, properties.value()); 283 Node* object = AllocateJSObjectFromMap(initial_map, properties.value());
284 284
285 Node* instance_size_words = ChangeUint32ToWord(LoadObjectField(
286 initial_map, Map::kInstanceSizeOffset, MachineType::Uint8()));
287 Node* instance_size =
288 WordShl(instance_size_words, IntPtrConstant(kPointerSizeLog2));
289
290 // Perform in-object slack tracking if requested. 285 // Perform in-object slack tracking if requested.
291 Node* bit_field3 = LoadMapBitField3(initial_map); 286 HandleSlackTracking(context, object, initial_map, JSObject::kHeaderSize);
292 Label slack_tracking(this), finalize(this, Label::kDeferred), done(this);
293 GotoIf(IsSetWord32<Map::ConstructionCounter>(bit_field3), &slack_tracking);
294
295 // Initialize remaining fields.
296 {
297 Comment("no slack tracking");
298 InitializeFieldsWithRoot(object, IntPtrConstant(JSObject::kHeaderSize),
299 instance_size, Heap::kUndefinedValueRootIndex);
300 Goto(&end);
301 }
302
303 {
304 BIND(&slack_tracking);
305
306 // Decrease generous allocation count.
307 STATIC_ASSERT(Map::ConstructionCounter::kNext == 32);
308 Comment("update allocation count");
309 Node* new_bit_field3 = Int32Sub(
310 bit_field3, Int32Constant(1 << Map::ConstructionCounter::kShift));
311 StoreObjectFieldNoWriteBarrier(initial_map, Map::kBitField3Offset,
312 new_bit_field3,
313 MachineRepresentation::kWord32);
314 GotoIf(IsClearWord32<Map::ConstructionCounter>(new_bit_field3), &finalize);
315
316 Node* unused_fields = LoadObjectField(
317 initial_map, Map::kUnusedPropertyFieldsOffset, MachineType::Uint8());
318 Node* used_size =
319 IntPtrSub(instance_size, WordShl(ChangeUint32ToWord(unused_fields),
320 IntPtrConstant(kPointerSizeLog2)));
321
322 Comment("initialize filler fields (no finalize)");
323 InitializeFieldsWithRoot(object, used_size, instance_size,
324 Heap::kOnePointerFillerMapRootIndex);
325
326 Comment("initialize undefined fields (no finalize)");
327 InitializeFieldsWithRoot(object, IntPtrConstant(JSObject::kHeaderSize),
328 used_size, Heap::kUndefinedValueRootIndex);
329 Goto(&end);
330 }
331
332 {
333 // Finalize the instance size.
334 BIND(&finalize);
335
336 Node* unused_fields = LoadObjectField(
337 initial_map, Map::kUnusedPropertyFieldsOffset, MachineType::Uint8());
338 Node* used_size =
339 IntPtrSub(instance_size, WordShl(ChangeUint32ToWord(unused_fields),
340 IntPtrConstant(kPointerSizeLog2)));
341
342 Comment("initialize filler fields (finalize)");
343 InitializeFieldsWithRoot(object, used_size, instance_size,
344 Heap::kOnePointerFillerMapRootIndex);
345
346 Comment("initialize undefined fields (finalize)");
347 InitializeFieldsWithRoot(object, IntPtrConstant(JSObject::kHeaderSize),
348 used_size, Heap::kUndefinedValueRootIndex);
349
350 CallRuntime(Runtime::kFinalizeInstanceSize, context, initial_map);
351 Goto(&end);
352 }
353
354 BIND(&end);
355 return object; 287 return object;
356 } 288 }
357 289
358 Node* ConstructorBuiltinsAssembler::EmitFastNewFunctionContext( 290 Node* ConstructorBuiltinsAssembler::EmitFastNewFunctionContext(
359 Node* function, Node* slots, Node* context, ScopeType scope_type) { 291 Node* function, Node* slots, Node* context, ScopeType scope_type) {
360 slots = ChangeUint32ToWord(slots); 292 slots = ChangeUint32ToWord(slots);
361 293
362 // TODO(ishell): Use CSA::OptimalParameterMode() here. 294 // TODO(ishell): Use CSA::OptimalParameterMode() here.
363 ParameterMode mode = INTPTR_PARAMETERS; 295 ParameterMode mode = INTPTR_PARAMETERS;
364 Node* min_context_slots = IntPtrConstant(Context::MIN_CONTEXT_SLOTS); 296 Node* min_context_slots = IntPtrConstant(Context::MIN_CONTEXT_SLOTS);
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 SHALLOW_OBJECT_BUILTIN(0); 691 SHALLOW_OBJECT_BUILTIN(0);
760 SHALLOW_OBJECT_BUILTIN(1); 692 SHALLOW_OBJECT_BUILTIN(1);
761 SHALLOW_OBJECT_BUILTIN(2); 693 SHALLOW_OBJECT_BUILTIN(2);
762 SHALLOW_OBJECT_BUILTIN(3); 694 SHALLOW_OBJECT_BUILTIN(3);
763 SHALLOW_OBJECT_BUILTIN(4); 695 SHALLOW_OBJECT_BUILTIN(4);
764 SHALLOW_OBJECT_BUILTIN(5); 696 SHALLOW_OBJECT_BUILTIN(5);
765 SHALLOW_OBJECT_BUILTIN(6); 697 SHALLOW_OBJECT_BUILTIN(6);
766 698
767 } // namespace internal 699 } // namespace internal
768 } // namespace v8 700 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/builtins/builtins-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698