Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 359 former_start[to_trim + 1] = Smi::FromInt(len - to_trim); | 359 former_start[to_trim + 1] = Smi::FromInt(len - to_trim); |
| 360 | 360 |
| 361 return FixedArray::cast(HeapObject::FromAddress( | 361 return FixedArray::cast(HeapObject::FromAddress( |
| 362 elms->address() + to_trim * kPointerSize)); | 362 elms->address() + to_trim * kPointerSize)); |
| 363 } | 363 } |
| 364 | 364 |
| 365 | 365 |
| 366 static bool ArrayPrototypeHasNoElements(Heap* heap, | 366 static bool ArrayPrototypeHasNoElements(Heap* heap, |
| 367 Context* global_context, | 367 Context* global_context, |
| 368 JSObject* array_proto) { | 368 JSObject* array_proto) { |
| 369 // This method depends on non writability of Object and Array prototype | 369 // This method depends on non writability of Object and Array prototype |
|
antonm
2011/05/24 12:33:59
just fyi, this comment is still here
| |
| 370 // fields. | 370 // fields. |
| 371 if (array_proto->elements() != heap->empty_fixed_array()) return false; | 371 if (array_proto->elements() != heap->empty_fixed_array()) return false; |
| 372 // Hidden prototype | 372 // Hidden prototype |
| 373 array_proto = JSObject::cast(array_proto->GetPrototype()); | 373 array_proto = JSObject::cast(array_proto->GetPrototype()); |
| 374 ASSERT(array_proto->elements() == heap->empty_fixed_array()); | 374 ASSERT(array_proto->elements() == heap->empty_fixed_array()); |
| 375 // Object.prototype | 375 // Object.prototype |
| 376 Object* proto = array_proto->GetPrototype(); | 376 Object* proto = array_proto->GetPrototype(); |
| 377 if (proto == heap->null_value()) return false; | 377 if (proto == heap->null_value()) return false; |
| 378 array_proto = JSObject::cast(proto); | 378 array_proto = JSObject::cast(proto); |
| 379 if (array_proto != global_context->initial_object_prototype()) return false; | 379 if (array_proto != global_context->initial_object_prototype()) return false; |
| 380 if (array_proto->elements() != heap->empty_fixed_array()) return false; | 380 if (array_proto->elements() != heap->empty_fixed_array()) return false; |
| 381 ASSERT(array_proto->GetPrototype()->IsNull()); | 381 return array_proto->GetPrototype()->IsNull(); |
| 382 return true; | |
| 383 } | 382 } |
| 384 | 383 |
| 385 | 384 |
| 386 MUST_USE_RESULT | 385 MUST_USE_RESULT |
| 387 static inline MaybeObject* EnsureJSArrayWithWritableFastElements( | 386 static inline MaybeObject* EnsureJSArrayWithWritableFastElements( |
| 388 Heap* heap, Object* receiver) { | 387 Heap* heap, Object* receiver) { |
| 389 if (!receiver->IsJSArray()) return NULL; | 388 if (!receiver->IsJSArray()) return NULL; |
| 390 JSArray* array = JSArray::cast(receiver); | 389 JSArray* array = JSArray::cast(receiver); |
| 391 HeapObject* elms = array->elements(); | 390 HeapObject* elms = array->elements(); |
| 392 if (elms->map() == heap->fixed_array_map()) return elms; | 391 if (elms->map() == heap->fixed_array_map()) return elms; |
| (...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1721 return Handle<Code>(code_address); \ | 1720 return Handle<Code>(code_address); \ |
| 1722 } | 1721 } |
| 1723 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1722 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
| 1724 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1723 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1725 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1724 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1726 #undef DEFINE_BUILTIN_ACCESSOR_C | 1725 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 1727 #undef DEFINE_BUILTIN_ACCESSOR_A | 1726 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 1728 | 1727 |
| 1729 | 1728 |
| 1730 } } // namespace v8::internal | 1729 } } // namespace v8::internal |
| OLD | NEW |