OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1707 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); | 1707 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); |
1708 Handle<FixedArray> entries = | 1708 Handle<FixedArray> entries = |
1709 isolate->factory()->NewFixedArray(table->NumberOfElements() * 2); | 1709 isolate->factory()->NewFixedArray(table->NumberOfElements() * 2); |
1710 { | 1710 { |
1711 DisallowHeapAllocation no_gc; | 1711 DisallowHeapAllocation no_gc; |
1712 int number_of_non_hole_elements = 0; | 1712 int number_of_non_hole_elements = 0; |
1713 for (int i = 0; i < table->Capacity(); i++) { | 1713 for (int i = 0; i < table->Capacity(); i++) { |
1714 Handle<Object> key(table->KeyAt(i), isolate); | 1714 Handle<Object> key(table->KeyAt(i), isolate); |
1715 if (table->IsKey(*key)) { | 1715 if (table->IsKey(*key)) { |
1716 entries->set(number_of_non_hole_elements++, *key); | 1716 entries->set(number_of_non_hole_elements++, *key); |
1717 entries->set(number_of_non_hole_elements++, table->Lookup(key)); | 1717 Object* value = table->Lookup(key); |
| 1718 entries->set(number_of_non_hole_elements++, value); |
1718 } | 1719 } |
1719 } | 1720 } |
1720 DCHECK_EQ(table->NumberOfElements() * 2, number_of_non_hole_elements); | 1721 DCHECK_EQ(table->NumberOfElements() * 2, number_of_non_hole_elements); |
1721 } | 1722 } |
1722 return *isolate->factory()->NewJSArrayWithElements(entries); | 1723 return *isolate->factory()->NewJSArrayWithElements(entries); |
1723 } | 1724 } |
1724 | 1725 |
1725 | 1726 |
1726 RUNTIME_FUNCTION(Runtime_MapIteratorNext) { | 1727 RUNTIME_FUNCTION(Runtime_MapIteratorNext) { |
1727 SealHandleScope shs(isolate); | 1728 SealHandleScope shs(isolate); |
(...skipping 13917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15645 } | 15646 } |
15646 return NULL; | 15647 return NULL; |
15647 } | 15648 } |
15648 | 15649 |
15649 | 15650 |
15650 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15651 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15651 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15652 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15652 } | 15653 } |
15653 | 15654 |
15654 } } // namespace v8::internal | 15655 } } // namespace v8::internal |
OLD | NEW |