| Index: src/ia32/macro-assembler-ia32.cc
|
| ===================================================================
|
| --- src/ia32/macro-assembler-ia32.cc (revision 3964)
|
| +++ src/ia32/macro-assembler-ia32.cc (working copy)
|
| @@ -174,7 +174,10 @@
|
| int32_t new_space_start = reinterpret_cast<int32_t>(
|
| ExternalReference::new_space_start().address());
|
| lea(value, Operand(object, -new_space_start));
|
| - and_(value, Heap::NewSpaceMask());
|
| + // The mask isn't really an address. We load it as an external reference in
|
| + // case the size of the new space is different between the snapshot maker
|
| + // and the running system.
|
| + and_(Operand(value), Immediate(ExternalReference::new_space_mask()));
|
| j(equal, &done);
|
| }
|
|
|
| @@ -1189,18 +1192,25 @@
|
| }
|
|
|
|
|
| -void MacroAssembler::TailCallRuntime(const ExternalReference& ext,
|
| - int num_arguments,
|
| - int result_size) {
|
| +void MacroAssembler::TailCallExternalReference(const ExternalReference& ext,
|
| + int num_arguments,
|
| + int result_size) {
|
| // TODO(1236192): Most runtime routines don't need the number of
|
| // arguments passed in because it is constant. At some point we
|
| // should remove this need and make the runtime routine entry code
|
| // smarter.
|
| Set(eax, Immediate(num_arguments));
|
| - JumpToRuntime(ext);
|
| + JumpToExternalReference(ext);
|
| }
|
|
|
|
|
| +void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid,
|
| + int num_arguments,
|
| + int result_size) {
|
| + TailCallExternalReference(ExternalReference(fid), num_arguments, result_size);
|
| +}
|
| +
|
| +
|
| void MacroAssembler::PushHandleScope(Register scratch) {
|
| // Push the number of extensions, smi-tagged so the gc will ignore it.
|
| ExternalReference extensions_address =
|
| @@ -1267,7 +1277,7 @@
|
| }
|
|
|
|
|
| -void MacroAssembler::JumpToRuntime(const ExternalReference& ext) {
|
| +void MacroAssembler::JumpToExternalReference(const ExternalReference& ext) {
|
| // Set the entry point and jump to the C entry runtime stub.
|
| mov(ebx, Immediate(ext));
|
| CEntryStub ces(1);
|
| @@ -1618,6 +1628,41 @@
|
| }
|
|
|
|
|
| +void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) {
|
| + int frameAlignment = OS::ActivationFrameAlignment();
|
| + if (frameAlignment != 0) {
|
| + // Make stack end at alignment and make room for num_arguments words
|
| + // and the original value of esp.
|
| + mov(scratch, esp);
|
| + sub(Operand(esp), Immediate((num_arguments + 1) * kPointerSize));
|
| + ASSERT(IsPowerOf2(frameAlignment));
|
| + and_(esp, -frameAlignment);
|
| + mov(Operand(esp, num_arguments * kPointerSize), scratch);
|
| + } else {
|
| + sub(Operand(esp), Immediate(num_arguments * kPointerSize));
|
| + }
|
| +}
|
| +
|
| +
|
| +void MacroAssembler::CallCFunction(ExternalReference function,
|
| + int num_arguments) {
|
| + // Trashing eax is ok as it will be the return value.
|
| + mov(Operand(eax), Immediate(function));
|
| + CallCFunction(eax, num_arguments);
|
| +}
|
| +
|
| +
|
| +void MacroAssembler::CallCFunction(Register function,
|
| + int num_arguments) {
|
| + call(Operand(function));
|
| + if (OS::ActivationFrameAlignment() != 0) {
|
| + mov(esp, Operand(esp, num_arguments * kPointerSize));
|
| + } else {
|
| + add(Operand(esp), Immediate(num_arguments * sizeof(int32_t)));
|
| + }
|
| +}
|
| +
|
| +
|
| CodePatcher::CodePatcher(byte* address, int size)
|
| : address_(address), size_(size), masm_(address, size + Assembler::kGap) {
|
| // Create a new macro assembler pointing to the address of the code to patch.
|
|
|