Revision f230a1cf deps/v8/test/cctest/test-alloc.cc

View differences:

deps/v8/test/cctest/test-alloc.cc
37 37
static MaybeObject* AllocateAfterFailures() {
38 38
  static int attempts = 0;
39 39
  if (++attempts < 3) return Failure::RetryAfterGC();
40
  Heap* heap = Isolate::Current()->heap();
40
  Heap* heap = CcTest::heap();
41 41

  
42 42
  // New space.
43 43
  SimulateFullSpace(heap->new_space());
......
50 50
  CHECK(!heap->AllocateHeapNumber(0.42)->IsFailure());
51 51
  CHECK(!heap->AllocateArgumentsObject(Smi::FromInt(87), 10)->IsFailure());
52 52
  Object* object = heap->AllocateJSObject(
53
      *Isolate::Current()->object_function())->ToObjectChecked();
53
      *CcTest::i_isolate()->object_function())->ToObjectChecked();
54 54
  CHECK(!heap->CopyJSObject(JSObject::cast(object))->IsFailure());
55 55

  
56 56
  // Old data space.
......
81 81
  // Test that we can allocate in old pointer space and code space.
82 82
  SimulateFullSpace(heap->code_space());
83 83
  CHECK(!heap->AllocateFixedArray(100, TENURED)->IsFailure());
84
  CHECK(!heap->CopyCode(Isolate::Current()->builtins()->builtin(
84
  CHECK(!heap->CopyCode(CcTest::i_isolate()->builtins()->builtin(
85 85
      Builtins::kIllegal))->IsFailure());
86 86

  
87 87
  // Return success.
......
90 90

  
91 91

  
92 92
static Handle<Object> Test() {
93
  CALL_HEAP_FUNCTION(Isolate::Current(), AllocateAfterFailures(), Object);
93
  CALL_HEAP_FUNCTION(CcTest::i_isolate(), AllocateAfterFailures(), Object);
94 94
}
95 95

  
96 96

  
97 97
TEST(StressHandles) {
98
  v8::HandleScope scope(v8::Isolate::GetCurrent());
99
  v8::Handle<v8::Context> env = v8::Context::New(v8::Isolate::GetCurrent());
98
  v8::HandleScope scope(CcTest::isolate());
99
  v8::Handle<v8::Context> env = v8::Context::New(CcTest::isolate());
100 100
  env->Enter();
101 101
  Handle<Object> o = Test();
102 102
  CHECK(o->IsSmi() && Smi::cast(*o)->value() == 42);
......
117 117

  
118 118

  
119 119
TEST(StressJS) {
120
  Isolate* isolate = Isolate::Current();
120
  Isolate* isolate = CcTest::i_isolate();
121 121
  Factory* factory = isolate->factory();
122
  v8::HandleScope scope(v8::Isolate::GetCurrent());
123
  v8::Handle<v8::Context> env = v8::Context::New(v8::Isolate::GetCurrent());
122
  v8::HandleScope scope(CcTest::isolate());
123
  v8::Handle<v8::Context> env = v8::Context::New(CcTest::isolate());
124 124
  env->Enter();
125 125
  Handle<JSFunction> function =
126 126
      factory->NewFunction(factory->function_string(), factory->null_value());
127 127
  // Force the creation of an initial map and set the code to
128 128
  // something empty.
129 129
  factory->NewJSObject(function);
130
  function->ReplaceCode(Isolate::Current()->builtins()->builtin(
130
  function->ReplaceCode(CcTest::i_isolate()->builtins()->builtin(
131 131
      Builtins::kEmptyFunction));
132 132
  // Patch the map to have an accessor for "get".
133 133
  Handle<Map> map(function->initial_map());

Also available in: Unified diff