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

Side by Side Diff: src/ppc/macro-assembler-ppc.cc

Issue 1668233003: PPC: Write barrier for storing a code entry, and usage in CompileLazy builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 | « src/ppc/macro-assembler-ppc.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 <assert.h> // For assert 5 #include <assert.h> // For assert
6 #include <limits.h> // For LONG_MIN, LONG_MAX. 6 #include <limits.h> // For LONG_MIN, LONG_MAX.
7 7
8 #if V8_TARGET_ARCH_PPC 8 #if V8_TARGET_ARCH_PPC
9 9
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 value); 480 value);
481 481
482 // Clobber clobbered registers when running with the debug-code flag 482 // Clobber clobbered registers when running with the debug-code flag
483 // turned on to provoke errors. 483 // turned on to provoke errors.
484 if (emit_debug_code()) { 484 if (emit_debug_code()) {
485 mov(address, Operand(bit_cast<intptr_t>(kZapValue + 12))); 485 mov(address, Operand(bit_cast<intptr_t>(kZapValue + 12)));
486 mov(value, Operand(bit_cast<intptr_t>(kZapValue + 16))); 486 mov(value, Operand(bit_cast<intptr_t>(kZapValue + 16)));
487 } 487 }
488 } 488 }
489 489
490 void MacroAssembler::RecordWriteCodeEntryField(Register js_function,
491 Register code_entry,
492 Register scratch) {
493 const int offset = JSFunction::kCodeEntryOffset;
494
495 // Since a code entry (value) is always in old space, we don't need to update
496 // remembered set. If incremental marking is off, there is nothing for us to
497 // do.
498 if (!FLAG_incremental_marking) return;
499
500 DCHECK(js_function.is(r4));
501 DCHECK(code_entry.is(r7));
502 DCHECK(scratch.is(r8));
503 AssertNotSmi(js_function);
504
505 if (emit_debug_code()) {
506 addi(scratch, js_function, Operand(offset - kHeapObjectTag));
507 LoadP(ip, MemOperand(scratch));
508 cmp(ip, code_entry);
509 Check(eq, kWrongAddressOrValuePassedToRecordWrite);
510 }
511
512 // First, check if a write barrier is even needed. The tests below
513 // catch stores of Smis and stores into young gen.
514 Label done;
515
516 CheckPageFlag(code_entry, scratch,
517 MemoryChunk::kPointersToHereAreInterestingMask, eq, &done);
518 CheckPageFlag(js_function, scratch,
519 MemoryChunk::kPointersFromHereAreInterestingMask, eq, &done);
520
521 const Register dst = scratch;
522 addi(dst, js_function, Operand(offset - kHeapObjectTag));
523
524 // Save caller-saved registers. js_function and code_entry are in the
525 // caller-saved register list.
526 DCHECK(kJSCallerSaved & js_function.bit());
527 DCHECK(kJSCallerSaved & code_entry.bit());
528 mflr(r0);
529 MultiPush(kJSCallerSaved | r0.bit());
530
531 int argument_count = 3;
532 PrepareCallCFunction(argument_count, code_entry);
533
534 mr(r3, js_function);
535 mr(r4, dst);
536 mov(r5, Operand(ExternalReference::isolate_address(isolate())));
537
538 {
539 AllowExternalCallThatCantCauseGC scope(this);
540 CallCFunction(
541 ExternalReference::incremental_marking_record_write_code_entry_function(
542 isolate()),
543 argument_count);
544 }
545
546 // Restore caller-saved registers (including js_function and code_entry).
547 MultiPop(kJSCallerSaved | r0.bit());
548 mtlr(r0);
549
550 bind(&done);
551 }
490 552
491 void MacroAssembler::RememberedSetHelper(Register object, // For debug tests. 553 void MacroAssembler::RememberedSetHelper(Register object, // For debug tests.
492 Register address, Register scratch, 554 Register address, Register scratch,
493 SaveFPRegsMode fp_mode, 555 SaveFPRegsMode fp_mode,
494 RememberedSetFinalAction and_then) { 556 RememberedSetFinalAction and_then) {
495 Label done; 557 Label done;
496 if (emit_debug_code()) { 558 if (emit_debug_code()) {
497 Label ok; 559 Label ok;
498 JumpIfNotInNewSpace(object, scratch, &ok); 560 JumpIfNotInNewSpace(object, scratch, &ok);
499 stop("Remembered set pointer is in new space"); 561 stop("Remembered set pointer is in new space");
(...skipping 3849 matching lines...) Expand 10 before | Expand all | Expand 10 after
4349 } 4411 }
4350 if (mag.shift > 0) srawi(result, result, mag.shift); 4412 if (mag.shift > 0) srawi(result, result, mag.shift);
4351 ExtractBit(r0, dividend, 31); 4413 ExtractBit(r0, dividend, 31);
4352 add(result, result, r0); 4414 add(result, result, r0);
4353 } 4415 }
4354 4416
4355 } // namespace internal 4417 } // namespace internal
4356 } // namespace v8 4418 } // namespace v8
4357 4419
4358 #endif // V8_TARGET_ARCH_PPC 4420 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/ppc/macro-assembler-ppc.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698