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

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

Issue 1434793002: PPC: Support fast-path allocation for subclass constructors with correctly initialized initial maps. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 | 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 #if V8_TARGET_ARCH_PPC 5 #if V8_TARGET_ARCH_PPC
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 // the preconditions is not met, the code bails out to the runtime call. 389 // the preconditions is not met, the code bails out to the runtime call.
390 Label rt_call, allocated; 390 Label rt_call, allocated;
391 if (FLAG_inline_new) { 391 if (FLAG_inline_new) {
392 ExternalReference debug_step_in_fp = 392 ExternalReference debug_step_in_fp =
393 ExternalReference::debug_step_in_fp_address(isolate); 393 ExternalReference::debug_step_in_fp_address(isolate);
394 __ mov(r5, Operand(debug_step_in_fp)); 394 __ mov(r5, Operand(debug_step_in_fp));
395 __ LoadP(r5, MemOperand(r5)); 395 __ LoadP(r5, MemOperand(r5));
396 __ cmpi(r5, Operand::Zero()); 396 __ cmpi(r5, Operand::Zero());
397 __ bne(&rt_call); 397 __ bne(&rt_call);
398 398
399 // Fall back to runtime if the original constructor and function differ. 399 // Verify that the original constructor is a JSFunction.
400 __ cmp(r4, r6); 400 __ CompareObjectType(r6, r8, r7, JS_FUNCTION_TYPE);
401 __ bne(&rt_call); 401 __ bne(&rt_call);
402 402
403 // Load the initial map and verify that it is in fact a map. 403 // Load the initial map and verify that it is in fact a map.
404 // r4: constructor function 404 // r6: original constructor
405 __ LoadP(r5, 405 __ LoadP(r5,
406 FieldMemOperand(r4, JSFunction::kPrototypeOrInitialMapOffset)); 406 FieldMemOperand(r6, JSFunction::kPrototypeOrInitialMapOffset));
407 __ JumpIfSmi(r5, &rt_call); 407 __ JumpIfSmi(r5, &rt_call);
408 __ CompareObjectType(r5, r8, r7, MAP_TYPE); 408 __ CompareObjectType(r5, r8, r7, MAP_TYPE);
409 __ bne(&rt_call); 409 __ bne(&rt_call);
410 410
411 // Fall back to runtime if the expected base constructor and base
412 // constructor differ.
413 __ LoadP(r8, FieldMemOperand(r5, Map::kConstructorOrBackPointerOffset));
414 __ cmp(r4, r8);
415 __ bne(&rt_call);
416
411 // Check that the constructor is not constructing a JSFunction (see 417 // Check that the constructor is not constructing a JSFunction (see
412 // comments in Runtime_NewObject in runtime.cc). In which case the 418 // comments in Runtime_NewObject in runtime.cc). In which case the
413 // initial map's instance type would be JS_FUNCTION_TYPE. 419 // initial map's instance type would be JS_FUNCTION_TYPE.
414 // r4: constructor function 420 // r4: constructor function
415 // r5: initial map 421 // r5: initial map
416 __ CompareInstanceType(r5, r8, JS_FUNCTION_TYPE); 422 __ CompareInstanceType(r5, r8, JS_FUNCTION_TYPE);
417 __ beq(&rt_call); 423 __ beq(&rt_call);
418 424
419 if (!is_api_function) { 425 if (!is_api_function) {
420 Label allocate; 426 Label allocate;
421 MemOperand bit_field3 = FieldMemOperand(r5, Map::kBitField3Offset); 427 MemOperand bit_field3 = FieldMemOperand(r5, Map::kBitField3Offset);
422 // Check if slack tracking is enabled. 428 // Check if slack tracking is enabled.
423 __ lwz(r7, bit_field3); 429 __ lwz(r7, bit_field3);
424 __ DecodeField<Map::Counter>(r11, r7); 430 __ DecodeField<Map::Counter>(r11, r7);
425 __ cmpi(r11, Operand(Map::kSlackTrackingCounterEnd)); 431 __ cmpi(r11, Operand(Map::kSlackTrackingCounterEnd));
426 __ blt(&allocate); 432 __ blt(&allocate);
427 // Decrease generous allocation count. 433 // Decrease generous allocation count.
428 __ Add(r7, r7, -(1 << Map::Counter::kShift), r0); 434 __ Add(r7, r7, -(1 << Map::Counter::kShift), r0);
429 __ stw(r7, bit_field3); 435 __ stw(r7, bit_field3);
430 __ cmpi(r11, Operand(Map::kSlackTrackingCounterEnd)); 436 __ cmpi(r11, Operand(Map::kSlackTrackingCounterEnd));
431 __ bne(&allocate); 437 __ bne(&allocate);
432 438
433 __ push(r4); 439 __ Push(r4, r5, r5); // r5 = initial map
434
435 __ Push(r5, r4); // r4 = constructor
436 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1); 440 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1);
437 441
438 __ Pop(r4, r5); 442 __ Pop(r4, r5);
439 443
440 __ bind(&allocate); 444 __ bind(&allocate);
441 } 445 }
442 446
443 // Now allocate the JSObject on the heap. 447 // Now allocate the JSObject on the heap.
444 // r4: constructor function 448 // r4: constructor function
445 // r5: initial map 449 // r5: initial map
(...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after
1973 __ bkpt(0); 1977 __ bkpt(0);
1974 } 1978 }
1975 } 1979 }
1976 1980
1977 1981
1978 #undef __ 1982 #undef __
1979 } // namespace internal 1983 } // namespace internal
1980 } // namespace v8 1984 } // namespace v8
1981 1985
1982 #endif // V8_TARGET_ARCH_PPC 1986 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698