| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 Code::ComputeFlags(Code::STUB), | 141 Code::ComputeFlags(Code::STUB), |
| 142 Handle<Code>())->ToObjectChecked(); | 142 Handle<Code>())->ToObjectChecked(); |
| 143 CHECK(copy->IsCode()); | 143 CHECK(copy->IsCode()); |
| 144 HeapObject* obj_copy = HeapObject::cast(copy); | 144 HeapObject* obj_copy = HeapObject::cast(copy); |
| 145 Object* not_right = isolate->FindCodeObject(obj_copy->address() + | 145 Object* not_right = isolate->FindCodeObject(obj_copy->address() + |
| 146 obj_copy->Size() / 2); | 146 obj_copy->Size() / 2); |
| 147 CHECK(not_right != code); | 147 CHECK(not_right != code); |
| 148 } | 148 } |
| 149 | 149 |
| 150 | 150 |
| 151 TEST(HandleNull) { |
| 152 CcTest::InitializeVM(); |
| 153 Isolate* isolate = CcTest::i_isolate(); |
| 154 HandleScope outer_scope(isolate); |
| 155 LocalContext context; |
| 156 Handle<Object> n(reinterpret_cast<Object*>(NULL), isolate); |
| 157 CHECK(!n.is_null()); |
| 158 } |
| 159 |
| 160 |
| 151 TEST(HeapObjects) { | 161 TEST(HeapObjects) { |
| 152 CcTest::InitializeVM(); | 162 CcTest::InitializeVM(); |
| 153 Isolate* isolate = CcTest::i_isolate(); | 163 Isolate* isolate = CcTest::i_isolate(); |
| 154 Factory* factory = isolate->factory(); | 164 Factory* factory = isolate->factory(); |
| 155 Heap* heap = isolate->heap(); | 165 Heap* heap = isolate->heap(); |
| 156 | 166 |
| 157 HandleScope sc(isolate); | 167 HandleScope sc(isolate); |
| 158 Object* value = heap->NumberFromDouble(1.000123)->ToObjectChecked(); | 168 Object* value = heap->NumberFromDouble(1.000123)->ToObjectChecked(); |
| 159 CHECK(value->IsHeapNumber()); | 169 CHECK(value->IsHeapNumber()); |
| 160 CHECK(value->IsNumber()); | 170 CHECK(value->IsNumber()); |
| (...skipping 3616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3777 v8::Handle<v8::Object> global = CcTest::global(); | 3787 v8::Handle<v8::Object> global = CcTest::global(); |
| 3778 v8::Handle<v8::Function> g = | 3788 v8::Handle<v8::Function> g = |
| 3779 v8::Handle<v8::Function>::Cast(global->Get(v8_str("crash"))); | 3789 v8::Handle<v8::Function>::Cast(global->Get(v8_str("crash"))); |
| 3780 v8::Handle<v8::Value> args1[] = { v8_num(1) }; | 3790 v8::Handle<v8::Value> args1[] = { v8_num(1) }; |
| 3781 heap->DisableInlineAllocation(); | 3791 heap->DisableInlineAllocation(); |
| 3782 heap->set_allocation_timeout(1); | 3792 heap->set_allocation_timeout(1); |
| 3783 g->Call(global, 1, args1); | 3793 g->Call(global, 1, args1); |
| 3784 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); | 3794 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
| 3785 } | 3795 } |
| 3786 #endif | 3796 #endif |
| OLD | NEW |