OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 13227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13238 MaybeObject* maybe = obj->map()->Copy(); | 13238 MaybeObject* maybe = obj->map()->Copy(); |
13239 Map* map; | 13239 Map* map; |
13240 if (!maybe->To(&map)) return maybe; | 13240 if (!maybe->To(&map)) return maybe; |
13241 map->set_is_observed(is_observed); | 13241 map->set_is_observed(is_observed); |
13242 obj->set_map(map); | 13242 obj->set_map(map); |
13243 } | 13243 } |
13244 return isolate->heap()->undefined_value(); | 13244 return isolate->heap()->undefined_value(); |
13245 } | 13245 } |
13246 | 13246 |
13247 | 13247 |
| 13248 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetObservationState) { |
| 13249 ASSERT(args.length() == 0); |
| 13250 return isolate->heap()->observation_state(); |
| 13251 } |
| 13252 |
| 13253 |
| 13254 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectHashTable) { |
| 13255 ASSERT(args.length() == 0); |
| 13256 return ObjectHashTable::Allocate(0); |
| 13257 } |
| 13258 |
| 13259 |
| 13260 RUNTIME_FUNCTION(MaybeObject*, Runtime_ObjectHashTableGet) { |
| 13261 NoHandleAllocation ha; |
| 13262 ASSERT(args.length() == 2); |
| 13263 CONVERT_ARG_CHECKED(ObjectHashTable, table, 0); |
| 13264 Object* key = args[1]; |
| 13265 Object* lookup = table->Lookup(key); |
| 13266 return lookup->IsTheHole() ? isolate->heap()->undefined_value() : lookup; |
| 13267 } |
| 13268 |
| 13269 |
| 13270 RUNTIME_FUNCTION(MaybeObject*, Runtime_ObjectHashTableSet) { |
| 13271 HandleScope scope(isolate); |
| 13272 ASSERT(args.length() == 3); |
| 13273 CONVERT_ARG_HANDLE_CHECKED(ObjectHashTable, table, 0); |
| 13274 Handle<Object> key = args.at<Object>(1); |
| 13275 Handle<Object> value = args.at<Object>(2); |
| 13276 PutIntoObjectHashTable(table, key, value); |
| 13277 return isolate->heap()->undefined_value(); |
| 13278 } |
| 13279 |
| 13280 |
| 13281 RUNTIME_FUNCTION(MaybeObject*, Runtime_ObjectHashTableHas) { |
| 13282 NoHandleAllocation ha; |
| 13283 ASSERT(args.length() == 2); |
| 13284 CONVERT_ARG_CHECKED(ObjectHashTable, table, 0); |
| 13285 Object* key = args[1]; |
| 13286 Object* lookup = table->Lookup(key); |
| 13287 return isolate->heap()->ToBoolean(!lookup->IsTheHole()); |
| 13288 } |
| 13289 |
| 13290 |
13248 // ---------------------------------------------------------------------------- | 13291 // ---------------------------------------------------------------------------- |
13249 // Implementation of Runtime | 13292 // Implementation of Runtime |
13250 | 13293 |
13251 #define F(name, number_of_args, result_size) \ | 13294 #define F(name, number_of_args, result_size) \ |
13252 { Runtime::k##name, Runtime::RUNTIME, #name, \ | 13295 { Runtime::k##name, Runtime::RUNTIME, #name, \ |
13253 FUNCTION_ADDR(Runtime_##name), number_of_args, result_size }, | 13296 FUNCTION_ADDR(Runtime_##name), number_of_args, result_size }, |
13254 | 13297 |
13255 | 13298 |
13256 #define I(name, number_of_args, result_size) \ | 13299 #define I(name, number_of_args, result_size) \ |
13257 { Runtime::kInline##name, Runtime::INLINE, \ | 13300 { Runtime::kInline##name, Runtime::INLINE, \ |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13324 // Handle last resort GC and make sure to allow future allocations | 13367 // Handle last resort GC and make sure to allow future allocations |
13325 // to grow the heap without causing GCs (if possible). | 13368 // to grow the heap without causing GCs (if possible). |
13326 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13369 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13327 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13370 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13328 "Runtime::PerformGC"); | 13371 "Runtime::PerformGC"); |
13329 } | 13372 } |
13330 } | 13373 } |
13331 | 13374 |
13332 | 13375 |
13333 } } // namespace v8::internal | 13376 } } // namespace v8::internal |
OLD | NEW |