OLD | NEW |
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 "src/factory.h" | 5 #include "src/factory.h" |
6 | 6 |
7 #include "src/allocation-site-scopes.h" | 7 #include "src/allocation-site-scopes.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1403 bool crankshafted, | 1403 bool crankshafted, |
1404 int prologue_offset, | 1404 int prologue_offset, |
1405 bool is_debug) { | 1405 bool is_debug) { |
1406 Handle<ByteArray> reloc_info = NewByteArray(desc.reloc_size, TENURED); | 1406 Handle<ByteArray> reloc_info = NewByteArray(desc.reloc_size, TENURED); |
1407 | 1407 |
1408 // Compute size. | 1408 // Compute size. |
1409 int body_size = RoundUp(desc.instr_size, kObjectAlignment); | 1409 int body_size = RoundUp(desc.instr_size, kObjectAlignment); |
1410 int obj_size = Code::SizeFor(body_size); | 1410 int obj_size = Code::SizeFor(body_size); |
1411 | 1411 |
1412 Handle<Code> code = NewCodeRaw(obj_size, immovable); | 1412 Handle<Code> code = NewCodeRaw(obj_size, immovable); |
1413 DCHECK(isolate()->code_range() == NULL || !isolate()->code_range()->valid() || | 1413 DCHECK(isolate()->heap()->memory_allocator()->code_range() == NULL || |
1414 isolate()->code_range()->contains(code->address()) || | 1414 !isolate()->heap()->memory_allocator()->code_range()->valid() || |
| 1415 isolate()->heap()->memory_allocator()->code_range()->contains( |
| 1416 code->address()) || |
1415 obj_size <= isolate()->heap()->code_space()->AreaSize()); | 1417 obj_size <= isolate()->heap()->code_space()->AreaSize()); |
1416 | 1418 |
1417 // The code object has not been fully initialized yet. We rely on the | 1419 // The code object has not been fully initialized yet. We rely on the |
1418 // fact that no allocation will happen from this point on. | 1420 // fact that no allocation will happen from this point on. |
1419 DisallowHeapAllocation no_gc; | 1421 DisallowHeapAllocation no_gc; |
1420 code->set_gc_metadata(Smi::FromInt(0)); | 1422 code->set_gc_metadata(Smi::FromInt(0)); |
1421 code->set_ic_age(isolate()->heap()->global_ic_age()); | 1423 code->set_ic_age(isolate()->heap()->global_ic_age()); |
1422 code->set_instruction_size(desc.instr_size); | 1424 code->set_instruction_size(desc.instr_size); |
1423 code->set_relocation_info(*reloc_info); | 1425 code->set_relocation_info(*reloc_info); |
1424 code->set_flags(flags); | 1426 code->set_flags(flags); |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2379 } | 2381 } |
2380 | 2382 |
2381 | 2383 |
2382 Handle<Object> Factory::ToBoolean(bool value) { | 2384 Handle<Object> Factory::ToBoolean(bool value) { |
2383 return value ? true_value() : false_value(); | 2385 return value ? true_value() : false_value(); |
2384 } | 2386 } |
2385 | 2387 |
2386 | 2388 |
2387 } // namespace internal | 2389 } // namespace internal |
2388 } // namespace v8 | 2390 } // namespace v8 |
OLD | NEW |