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 2425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2436 return hstatistics(); | 2436 return hstatistics(); |
2437 } | 2437 } |
2438 | 2438 |
2439 | 2439 |
2440 HTracer* Isolate::GetHTracer() { | 2440 HTracer* Isolate::GetHTracer() { |
2441 if (htracer() == NULL) set_htracer(new HTracer(id())); | 2441 if (htracer() == NULL) set_htracer(new HTracer(id())); |
2442 return htracer(); | 2442 return htracer(); |
2443 } | 2443 } |
2444 | 2444 |
2445 | 2445 |
2446 Map* Isolate::get_initial_js_array_map(ElementsKind kind) { | |
2447 Context* native_context = context()->native_context(); | |
2448 Object* maybe_map_array = native_context->js_array_maps(); | |
2449 if (!maybe_map_array->IsUndefined()) { | |
2450 Object* maybe_transitioned_map = | |
2451 FixedArray::cast(maybe_map_array)->get(kind); | |
2452 if (!maybe_transitioned_map->IsUndefined()) { | |
2453 return Map::cast(maybe_transitioned_map); | |
2454 } | |
2455 } | |
2456 return NULL; | |
2457 } | |
2458 | |
2459 | |
2460 bool Isolate::IsFastArrayConstructorPrototypeChainIntact() { | |
2461 Map* root_array_map = | |
ulan
2013/05/10 14:34:25
Can root_array_map be NULL here?
danno
2013/05/10 14:40:12
Done.
| |
2462 get_initial_js_array_map(GetInitialFastElementsKind()); | |
2463 JSObject* initial_array_proto = JSObject::cast(*initial_array_prototype()); | |
2464 | |
2465 // Check that the array prototype hasn't been altered WRT empty elements. | |
2466 if (root_array_map->prototype() != initial_array_proto) return false; | |
2467 if (initial_array_proto->elements() != heap()->empty_fixed_array()) { | |
2468 return false; | |
2469 } | |
2470 | |
2471 // Check that the object prototype hasn't been altered WRT empty elements. | |
2472 JSObject* initial_object_proto = JSObject::cast(*initial_object_prototype()); | |
2473 Object* root_array_map_proto = initial_array_proto->GetPrototype(); | |
2474 if (root_array_map_proto != initial_object_proto) return false; | |
2475 if (initial_object_proto->elements() != heap()->empty_fixed_array()) { | |
2476 return false; | |
2477 } | |
2478 | |
2479 return initial_object_proto->GetPrototype()->IsNull(); | |
2480 } | |
2481 | |
2482 | |
2446 CodeStubInterfaceDescriptor* | 2483 CodeStubInterfaceDescriptor* |
2447 Isolate::code_stub_interface_descriptor(int index) { | 2484 Isolate::code_stub_interface_descriptor(int index) { |
2448 return code_stub_interface_descriptors_ + index; | 2485 return code_stub_interface_descriptors_ + index; |
2449 } | 2486 } |
2450 | 2487 |
2451 | 2488 |
2452 #ifdef DEBUG | 2489 #ifdef DEBUG |
2453 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2490 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
2454 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2491 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
2455 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2492 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
2456 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2493 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
2457 #undef ISOLATE_FIELD_OFFSET | 2494 #undef ISOLATE_FIELD_OFFSET |
2458 #endif | 2495 #endif |
2459 | 2496 |
2460 } } // namespace v8::internal | 2497 } } // namespace v8::internal |
OLD | NEW |