OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 8351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8362 // so they remain fast. | 8362 // so they remain fast. |
8363 if (!HasFastProperties()) { | 8363 if (!HasFastProperties()) { |
8364 MaybeObject* new_proto = TransformToFastProperties(0); | 8364 MaybeObject* new_proto = TransformToFastProperties(0); |
8365 if (new_proto->IsFailure()) return new_proto; | 8365 if (new_proto->IsFailure()) return new_proto; |
8366 ASSERT(new_proto == this); | 8366 ASSERT(new_proto == this); |
8367 } | 8367 } |
8368 return this; | 8368 return this; |
8369 } | 8369 } |
8370 | 8370 |
8371 | 8371 |
8372 MUST_USE_RESULT MaybeObject* CacheInitialJSArrayMaps( | 8372 static MUST_USE_RESULT MaybeObject* CacheInitialJSArrayMaps( |
8373 Context* native_context, Map* initial_map) { | 8373 Context* native_context, Map* initial_map) { |
8374 // Replace all of the cached initial array maps in the native context with | 8374 // Replace all of the cached initial array maps in the native context with |
8375 // the appropriate transitioned elements kind maps. | 8375 // the appropriate transitioned elements kind maps. |
8376 Heap* heap = native_context->GetHeap(); | 8376 Heap* heap = native_context->GetHeap(); |
8377 MaybeObject* maybe_maps = | 8377 MaybeObject* maybe_maps = |
8378 heap->AllocateFixedArrayWithHoles(kElementsKindCount, TENURED); | 8378 heap->AllocateFixedArrayWithHoles(kElementsKindCount, TENURED); |
8379 FixedArray* maps; | 8379 FixedArray* maps; |
8380 if (!maybe_maps->To(&maps)) return maybe_maps; | 8380 if (!maybe_maps->To(&maps)) return maybe_maps; |
8381 | 8381 |
8382 Map* current_map = initial_map; | 8382 Map* current_map = initial_map; |
8383 ElementsKind kind = current_map->elements_kind(); | 8383 ElementsKind kind = current_map->elements_kind(); |
8384 ASSERT(kind == GetInitialFastElementsKind()); | 8384 ASSERT(kind == GetInitialFastElementsKind()); |
8385 maps->set(kind, current_map); | 8385 maps->set(kind, current_map); |
8386 for (int i = GetSequenceIndexFromFastElementsKind(kind) + 1; | 8386 for (int i = GetSequenceIndexFromFastElementsKind(kind) + 1; |
8387 i < kFastElementsKindCount; ++i) { | 8387 i < kFastElementsKindCount; ++i) { |
8388 Map* new_map; | 8388 Map* new_map; |
8389 ElementsKind next_kind = GetFastElementsKindFromSequenceIndex(i); | 8389 ElementsKind next_kind = GetFastElementsKindFromSequenceIndex(i); |
8390 MaybeObject* maybe_new_map = | 8390 MaybeObject* maybe_new_map = |
8391 current_map->CopyAsElementsKind(next_kind, INSERT_TRANSITION); | 8391 current_map->CopyAsElementsKind(next_kind, INSERT_TRANSITION); |
8392 if (!maybe_new_map->To(&new_map)) return maybe_new_map; | 8392 if (!maybe_new_map->To(&new_map)) return maybe_new_map; |
8393 maps->set(next_kind, new_map); | 8393 maps->set(next_kind, new_map); |
8394 current_map = new_map; | 8394 current_map = new_map; |
8395 } | 8395 } |
8396 native_context->set_js_array_maps(maps); | 8396 native_context->set_js_array_maps(maps); |
8397 return initial_map; | 8397 return initial_map; |
8398 } | 8398 } |
8399 | 8399 |
8400 | 8400 |
| 8401 Handle<Object> CacheInitialJSArrayMaps(Handle<Context> native_context, |
| 8402 Handle<Map> initial_map) { |
| 8403 CALL_HEAP_FUNCTION(native_context->GetIsolate(), |
| 8404 CacheInitialJSArrayMaps(*native_context, *initial_map), |
| 8405 Object); |
| 8406 } |
| 8407 |
| 8408 |
8401 MaybeObject* JSFunction::SetInstancePrototype(Object* value) { | 8409 MaybeObject* JSFunction::SetInstancePrototype(Object* value) { |
8402 ASSERT(value->IsJSReceiver()); | 8410 ASSERT(value->IsJSReceiver()); |
8403 Heap* heap = GetHeap(); | 8411 Heap* heap = GetHeap(); |
8404 | 8412 |
8405 // First some logic for the map of the prototype to make sure it is in fast | 8413 // First some logic for the map of the prototype to make sure it is in fast |
8406 // mode. | 8414 // mode. |
8407 if (value->IsJSObject()) { | 8415 if (value->IsJSObject()) { |
8408 MaybeObject* ok = JSObject::cast(value)->OptimizeAsPrototype(); | 8416 MaybeObject* ok = JSObject::cast(value)->OptimizeAsPrototype(); |
8409 if (ok->IsFailure()) return ok; | 8417 if (ok->IsFailure()) return ok; |
8410 } | 8418 } |
(...skipping 6098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14509 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 14517 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
14510 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 14518 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
14511 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 14519 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
14512 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 14520 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
14513 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 14521 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
14514 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 14522 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
14515 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 14523 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
14516 } | 14524 } |
14517 | 14525 |
14518 } } // namespace v8::internal | 14526 } } // namespace v8::internal |
OLD | NEW |