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

Side by Side Diff: src/arm64/builtins-arm64.cc

Issue 767253002: Refactor Map::ConstructionCount. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix assert Created 6 years 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/arm/builtins-arm.cc ('k') | src/heap/heap.cc » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM64 7 #if V8_TARGET_ARCH_ARM64
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/debug.h" 10 #include "src/debug.h"
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 __ CompareInstanceType(init_map, x10, JS_FUNCTION_TYPE); 360 __ CompareInstanceType(init_map, x10, JS_FUNCTION_TYPE);
361 __ B(eq, &rt_call); 361 __ B(eq, &rt_call);
362 362
363 Register constructon_count = x14; 363 Register constructon_count = x14;
364 if (!is_api_function) { 364 if (!is_api_function) {
365 Label allocate; 365 Label allocate;
366 MemOperand bit_field3 = 366 MemOperand bit_field3 =
367 FieldMemOperand(init_map, Map::kBitField3Offset); 367 FieldMemOperand(init_map, Map::kBitField3Offset);
368 // Check if slack tracking is enabled. 368 // Check if slack tracking is enabled.
369 __ Ldr(x4, bit_field3); 369 __ Ldr(x4, bit_field3);
370 __ DecodeField<Map::ConstructionCount>(constructon_count, x4); 370 __ DecodeField<Map::Counter>(constructon_count, x4);
371 __ Cmp(constructon_count, Operand(JSFunction::kNoSlackTracking)); 371 __ Cmp(constructon_count, Operand(Map::kSlackTrackingCounterEnd));
372 __ B(eq, &allocate); 372 __ B(lt, &allocate);
373 // Decrease generous allocation count. 373 // Decrease generous allocation count.
374 __ Subs(x4, x4, Operand(1 << Map::ConstructionCount::kShift)); 374 __ Subs(x4, x4, Operand(1 << Map::Counter::kShift));
375 __ Str(x4, bit_field3); 375 __ Str(x4, bit_field3);
376 __ Cmp(constructon_count, Operand(JSFunction::kFinishSlackTracking)); 376 __ Cmp(constructon_count, Operand(Map::kSlackTrackingCounterEnd));
377 __ B(ne, &allocate); 377 __ B(ne, &allocate);
378 378
379 // Push the constructor and map to the stack, and the constructor again 379 // Push the constructor and map to the stack, and the constructor again
380 // as argument to the runtime call. 380 // as argument to the runtime call.
381 __ Push(constructor, init_map, constructor); 381 __ Push(constructor, init_map, constructor);
382 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1); 382 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1);
383 __ Pop(init_map, constructor); 383 __ Pop(init_map, constructor);
384 __ Mov(constructon_count, Operand(JSFunction::kNoSlackTracking)); 384 __ Mov(constructon_count, Operand(Map::kSlackTrackingCounterEnd - 1));
385 __ Bind(&allocate); 385 __ Bind(&allocate);
386 } 386 }
387 387
388 // Now allocate the JSObject on the heap. 388 // Now allocate the JSObject on the heap.
389 Register obj_size = x3; 389 Register obj_size = x3;
390 Register new_obj = x4; 390 Register new_obj = x4;
391 __ Ldrb(obj_size, FieldMemOperand(init_map, Map::kInstanceSizeOffset)); 391 __ Ldrb(obj_size, FieldMemOperand(init_map, Map::kInstanceSizeOffset));
392 if (create_memento) { 392 if (create_memento) {
393 __ Add(x7, obj_size, 393 __ Add(x7, obj_size,
394 Operand(AllocationMemento::kSize / kPointerSize)); 394 Operand(AllocationMemento::kSize / kPointerSize));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 Map::kInObjectPropertiesByte * kBitsPerByte, kBitsPerByte); 427 Map::kInObjectPropertiesByte * kBitsPerByte, kBitsPerByte);
428 428
429 // Calculate number of property fields in the object. 429 // Calculate number of property fields in the object.
430 Register prop_fields = x6; 430 Register prop_fields = x6;
431 __ Sub(prop_fields, obj_size, JSObject::kHeaderSize / kPointerSize); 431 __ Sub(prop_fields, obj_size, JSObject::kHeaderSize / kPointerSize);
432 432
433 if (!is_api_function) { 433 if (!is_api_function) {
434 Label no_inobject_slack_tracking; 434 Label no_inobject_slack_tracking;
435 435
436 // Check if slack tracking is enabled. 436 // Check if slack tracking is enabled.
437 __ Cmp(constructon_count, Operand(JSFunction::kNoSlackTracking)); 437 __ Cmp(constructon_count, Operand(Map::kSlackTrackingCounterEnd));
438 __ B(eq, &no_inobject_slack_tracking); 438 __ B(lt, &no_inobject_slack_tracking);
439 constructon_count = NoReg; 439 constructon_count = NoReg;
440 440
441 // Fill the pre-allocated fields with undef. 441 // Fill the pre-allocated fields with undef.
442 __ FillFields(first_prop, prealloc_fields, filler); 442 __ FillFields(first_prop, prealloc_fields, filler);
443 443
444 // Update first_prop register to be the offset of the first field after 444 // Update first_prop register to be the offset of the first field after
445 // pre-allocated fields. 445 // pre-allocated fields.
446 __ Add(first_prop, first_prop, 446 __ Add(first_prop, first_prop,
447 Operand(prealloc_fields, LSL, kPointerSizeLog2)); 447 Operand(prealloc_fields, LSL, kPointerSizeLog2));
448 448
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 __ Unreachable(); 1555 __ Unreachable();
1556 } 1556 }
1557 } 1557 }
1558 1558
1559 1559
1560 #undef __ 1560 #undef __
1561 1561
1562 } } // namespace v8::internal 1562 } } // namespace v8::internal
1563 1563
1564 #endif // V8_TARGET_ARCH_ARM 1564 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698