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 4619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4630 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 4630 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
4631 } | 4631 } |
4632 cache->set(EntryToIndex(entry), obj); | 4632 cache->set(EntryToIndex(entry), obj); |
4633 cache->set(EntryToIndex(entry) + 1, code); | 4633 cache->set(EntryToIndex(entry) + 1, code); |
4634 cache->ElementAdded(); | 4634 cache->ElementAdded(); |
4635 return cache; | 4635 return cache; |
4636 } | 4636 } |
4637 | 4637 |
4638 | 4638 |
4639 MaybeObject* FixedArray::AddKeysFromJSArray(JSArray* array) { | 4639 MaybeObject* FixedArray::AddKeysFromJSArray(JSArray* array) { |
4640 return array->GetElementsAccessor()->AddJSArrayKeysToFixedArray(array, this); | 4640 ElementsAccessor* accessor = array->GetElementsAccessor(); |
| 4641 MaybeObject* maybe_result = |
| 4642 accessor->AddElementsToFixedArray(array->elements(), this); |
| 4643 FixedArray* result; |
| 4644 if (!maybe_result->To<FixedArray>(&result)) return maybe_result; |
| 4645 #ifdef DEBUG |
| 4646 if (FLAG_enable_slow_asserts) { |
| 4647 for (int i = 0; i < result->length(); i++) { |
| 4648 Object* current = result->get(i); |
| 4649 ASSERT(current->IsNumber() || current->IsString()); |
| 4650 } |
| 4651 } |
| 4652 #endif |
| 4653 return result; |
4641 } | 4654 } |
4642 | 4655 |
4643 | 4656 |
4644 MaybeObject* FixedArray::UnionOfKeys(FixedArray* other) { | 4657 MaybeObject* FixedArray::UnionOfKeys(FixedArray* other) { |
4645 int len0 = length(); | 4658 int len0 = length(); |
4646 #ifdef DEBUG | 4659 #ifdef DEBUG |
4647 if (FLAG_enable_slow_asserts) { | 4660 if (FLAG_enable_slow_asserts) { |
4648 for (int i = 0; i < len0; i++) { | 4661 for (int i = 0; i < len0; i++) { |
4649 ASSERT(get(i)->IsString() || get(i)->IsNumber()); | 4662 ASSERT(get(i)->IsString() || get(i)->IsNumber()); |
4650 } | 4663 } |
(...skipping 2303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6954 | 6967 |
6955 | 6968 |
6956 #ifdef ENABLE_DISASSEMBLER | 6969 #ifdef ENABLE_DISASSEMBLER |
6957 | 6970 |
6958 void DeoptimizationInputData::DeoptimizationInputDataPrint(FILE* out) { | 6971 void DeoptimizationInputData::DeoptimizationInputDataPrint(FILE* out) { |
6959 disasm::NameConverter converter; | 6972 disasm::NameConverter converter; |
6960 int deopt_count = DeoptCount(); | 6973 int deopt_count = DeoptCount(); |
6961 PrintF(out, "Deoptimization Input Data (deopt points = %d)\n", deopt_count); | 6974 PrintF(out, "Deoptimization Input Data (deopt points = %d)\n", deopt_count); |
6962 if (0 == deopt_count) return; | 6975 if (0 == deopt_count) return; |
6963 | 6976 |
6964 PrintF(out, "%6s %6s %6s %12s\n", "index", "ast id", "argc", "commands"); | 6977 PrintF(out, "%6s %6s %6s %12s\n", "index", "ast id", "argc", |
| 6978 FLAG_print_code_verbose ? "commands" : ""); |
6965 for (int i = 0; i < deopt_count; i++) { | 6979 for (int i = 0; i < deopt_count; i++) { |
6966 PrintF(out, "%6d %6d %6d", | 6980 PrintF(out, "%6d %6d %6d", |
6967 i, AstId(i)->value(), ArgumentsStackHeight(i)->value()); | 6981 i, AstId(i)->value(), ArgumentsStackHeight(i)->value()); |
6968 | 6982 |
6969 if (!FLAG_print_code_verbose) continue; | 6983 if (!FLAG_print_code_verbose) { |
| 6984 PrintF(out, "\n"); |
| 6985 continue; |
| 6986 } |
6970 // Print details of the frame translation. | 6987 // Print details of the frame translation. |
6971 int translation_index = TranslationIndex(i)->value(); | 6988 int translation_index = TranslationIndex(i)->value(); |
6972 TranslationIterator iterator(TranslationByteArray(), translation_index); | 6989 TranslationIterator iterator(TranslationByteArray(), translation_index); |
6973 Translation::Opcode opcode = | 6990 Translation::Opcode opcode = |
6974 static_cast<Translation::Opcode>(iterator.Next()); | 6991 static_cast<Translation::Opcode>(iterator.Next()); |
6975 ASSERT(Translation::BEGIN == opcode); | 6992 ASSERT(Translation::BEGIN == opcode); |
6976 int frame_count = iterator.Next(); | 6993 int frame_count = iterator.Next(); |
6977 PrintF(out, " %s {count=%d}\n", Translation::StringFor(opcode), | 6994 PrintF(out, " %s {count=%d}\n", Translation::StringFor(opcode), |
6978 frame_count); | 6995 frame_count); |
6979 | 6996 |
(...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8396 } else { | 8413 } else { |
8397 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); | 8414 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); |
8398 Handle<String> name = isolate->factory()->NumberToString(number); | 8415 Handle<String> name = isolate->factory()->NumberToString(number); |
8399 Handle<Object> args[1] = { name }; | 8416 Handle<Object> args[1] = { name }; |
8400 Handle<Object> error = | 8417 Handle<Object> error = |
8401 isolate->factory()->NewTypeError("object_not_extensible", | 8418 isolate->factory()->NewTypeError("object_not_extensible", |
8402 HandleVector(args, 1)); | 8419 HandleVector(args, 1)); |
8403 return isolate->Throw(*error); | 8420 return isolate->Throw(*error); |
8404 } | 8421 } |
8405 } | 8422 } |
8406 Object* new_dictionary; | 8423 FixedArrayBase* new_dictionary; |
8407 MaybeObject* maybe = dictionary->AtNumberPut(index, value); | 8424 MaybeObject* maybe = dictionary->AtNumberPut(index, value); |
8408 if (!maybe->ToObject(&new_dictionary)) return maybe; | 8425 if (!maybe->To<FixedArrayBase>(&new_dictionary)) return maybe; |
8409 if (dictionary != NumberDictionary::cast(new_dictionary)) { | 8426 if (dictionary != NumberDictionary::cast(new_dictionary)) { |
8410 if (is_arguments) { | 8427 if (is_arguments) { |
8411 elements->set(1, new_dictionary); | 8428 elements->set(1, new_dictionary); |
8412 } else { | 8429 } else { |
8413 set_elements(HeapObject::cast(new_dictionary)); | 8430 set_elements(new_dictionary); |
8414 } | 8431 } |
8415 dictionary = NumberDictionary::cast(new_dictionary); | 8432 dictionary = NumberDictionary::cast(new_dictionary); |
8416 } | 8433 } |
8417 } | 8434 } |
8418 | 8435 |
8419 // Update the array length if this JSObject is an array. | 8436 // Update the array length if this JSObject is an array. |
8420 if (IsJSArray()) { | 8437 if (IsJSArray()) { |
8421 MaybeObject* result = | 8438 MaybeObject* result = |
8422 JSArray::cast(this)->JSArrayUpdateLengthFromIndex(index, value); | 8439 JSArray::cast(this)->JSArrayUpdateLengthFromIndex(index, value); |
8423 if (result->IsFailure()) return result; | 8440 if (result->IsFailure()) return result; |
(...skipping 3158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11582 if (break_point_objects()->IsUndefined()) return 0; | 11599 if (break_point_objects()->IsUndefined()) return 0; |
11583 // Single break point. | 11600 // Single break point. |
11584 if (!break_point_objects()->IsFixedArray()) return 1; | 11601 if (!break_point_objects()->IsFixedArray()) return 1; |
11585 // Multiple break points. | 11602 // Multiple break points. |
11586 return FixedArray::cast(break_point_objects())->length(); | 11603 return FixedArray::cast(break_point_objects())->length(); |
11587 } | 11604 } |
11588 #endif | 11605 #endif |
11589 | 11606 |
11590 | 11607 |
11591 } } // namespace v8::internal | 11608 } } // namespace v8::internal |
OLD | NEW |