| Index: test/cctest/test-macro-assembler-mips64.cc | 
| diff --git a/test/cctest/test-macro-assembler-mips64.cc b/test/cctest/test-macro-assembler-mips64.cc | 
| index f0180c18e336acfd865c38339d9ca5f626152ed1..cad341d0231337941c2c388cd6add5dfeaa5eb43 100644 | 
| --- a/test/cctest/test-macro-assembler-mips64.cc | 
| +++ b/test/cctest/test-macro-assembler-mips64.cc | 
| @@ -30,6 +30,7 @@ | 
|  | 
| #include "src/v8.h" | 
| #include "test/cctest/cctest.h" | 
| +#include "test/cctest/heap/heap-utils.h" | 
|  | 
| #include "src/base/utils/random-number-generator.h" | 
| #include "src/macro-assembler.h" | 
| @@ -1745,4 +1746,68 @@ TEST(Uldc1) { | 
| } | 
| } | 
|  | 
| +template <typename Fun> | 
| +void AssembleFunction(Isolate* isolate, size_t actual_size, byte* buffer, | 
| +                      Fun f) { | 
| +  MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size), | 
| +                           v8::internal::CodeObjectRequired::kYes); | 
| +  MacroAssembler* masm = &assembler; | 
| +  f(masm); | 
| +  __ jr(ra); | 
| + | 
| +  CodeDesc desc; | 
| +  masm->GetCode(&desc); | 
| +} | 
| + | 
| +TEST(AllocateMacrosNoGCRequired) { | 
| +  typedef intptr_t (*F0)(); | 
| +  // Allocate an executable page of memory. | 
| +  CcTest::InitializeVM(); | 
| +  size_t actual_size; | 
| +  byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( | 
| +      Assembler::kMinimalBufferSize, &actual_size, true)); | 
| +  CHECK(buffer); | 
| +  Isolate* isolate = CcTest::i_isolate(); | 
| +  HandleScope handles(isolate); | 
| + | 
| +  AllocationFlags const kNoAllocationFlags = | 
| +      static_cast<AllocationFlags>(NO_ALLOCATION_FLAGS); | 
| + | 
| +#define CHECK_TAGGED(result) CHECK_EQ(result& kHeapObjectTag, 1); | 
| + | 
| +  heap::GcAndSweep(isolate->heap(), AllocationSpace::NEW_SPACE); | 
| +  { | 
| +    AssembleFunction(isolate, actual_size, buffer, [](MacroAssembler* masm) { | 
| +      Label gc_required, success; | 
| +      __ Allocate(kPointerSize, v0, t0, t1, &gc_required, kNoAllocationFlags); | 
| +      __ jmp(&success); | 
| +      __ bind(&gc_required); | 
| +      __ Abort(kNoReason); | 
| +      __ bind(&success); | 
| +    }); | 
| +    F0 f = FUNCTION_CAST<F0>(buffer); | 
| +    intptr_t test_result = reinterpret_cast<intptr_t>( | 
| +        CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); | 
| +    CHECK_TAGGED(test_result); | 
| +  } | 
| + | 
| +  { | 
| +    AssembleFunction(isolate, actual_size, buffer, [](MacroAssembler* masm) { | 
| +      Label gc_required, success; | 
| +      __ li(a0, Operand(kPointerSize)); | 
| +      __ Allocate(a0, v0, t0, t1, &gc_required, kNoAllocationFlags); | 
| +      __ jmp(&success); | 
| +      __ bind(&gc_required); | 
| +      __ Abort(kNoReason); | 
| +      __ bind(&success); | 
| +    }); | 
| +    F0 f = FUNCTION_CAST<F0>(buffer); | 
| +    intptr_t test_result = reinterpret_cast<intptr_t>( | 
| +        CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); | 
| +    CHECK_TAGGED(test_result); | 
| +  } | 
| + | 
| +#undef CHECK_TAGGED | 
| +} | 
| + | 
| #undef __ | 
|  |