OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/conversions-inl.h" | 8 #include "src/conversions-inl.h" |
9 #include "src/factory.h" | 9 #include "src/factory.h" |
10 | 10 |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 DisallowHeapAllocation no_gc; | 361 DisallowHeapAllocation no_gc; |
362 int count = 0; | 362 int count = 0; |
363 for (int i = 0; count < max_values && i < table->Capacity(); i++) { | 363 for (int i = 0; count < max_values && i < table->Capacity(); i++) { |
364 Handle<Object> key(table->KeyAt(i), isolate); | 364 Handle<Object> key(table->KeyAt(i), isolate); |
365 if (table->IsKey(*key)) values->set(count++, *key); | 365 if (table->IsKey(*key)) values->set(count++, *key); |
366 } | 366 } |
367 DCHECK_EQ(max_values, count); | 367 DCHECK_EQ(max_values, count); |
368 } | 368 } |
369 return *isolate->factory()->NewJSArrayWithElements(values); | 369 return *isolate->factory()->NewJSArrayWithElements(values); |
370 } | 370 } |
371 | |
372 | |
373 RUNTIME_FUNCTION(Runtime_ObservationWeakMapCreate) { | |
374 HandleScope scope(isolate); | |
375 DCHECK(args.length() == 0); | |
376 Handle<JSWeakMap> weakmap = isolate->factory()->NewJSWeakMap(); | |
377 JSWeakCollection::Initialize(weakmap, isolate); | |
378 return *weakmap; | |
379 } | |
380 } // namespace internal | 371 } // namespace internal |
381 } // namespace v8 | 372 } // namespace v8 |
OLD | NEW |