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 13204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13215 #undef ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION | 13215 #undef ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION |
13216 | 13216 |
13217 | 13217 |
13218 RUNTIME_FUNCTION(MaybeObject*, Runtime_HaveSameMap) { | 13218 RUNTIME_FUNCTION(MaybeObject*, Runtime_HaveSameMap) { |
13219 ASSERT(args.length() == 2); | 13219 ASSERT(args.length() == 2); |
13220 CONVERT_ARG_CHECKED(JSObject, obj1, 0); | 13220 CONVERT_ARG_CHECKED(JSObject, obj1, 0); |
13221 CONVERT_ARG_CHECKED(JSObject, obj2, 1); | 13221 CONVERT_ARG_CHECKED(JSObject, obj2, 1); |
13222 return isolate->heap()->ToBoolean(obj1->map() == obj2->map()); | 13222 return isolate->heap()->ToBoolean(obj1->map() == obj2->map()); |
13223 } | 13223 } |
13224 | 13224 |
13225 | |
13226 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetObjectObservationState) { | |
13227 ASSERT(args.length() == 0); | |
13228 return isolate->heap()->object_observation_state(); | |
13229 } | |
13230 | |
13231 | |
13232 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectHashTable) { | |
13233 ASSERT(args.length() == 0); | |
13234 return ObjectHashTable::Allocate(0); | |
Michael Starzinger
2012/11/06 14:17:44
As discussed offline, having this non-JS object es
adamk
2012/11/06 14:54:21
Noted. I'd also be fine with wrapping this in a JS
| |
13235 } | |
13236 | |
13237 | |
13238 RUNTIME_FUNCTION(MaybeObject*, Runtime_ObjectHashTableGet) { | |
13239 NoHandleAllocation ha; | |
13240 ASSERT(args.length() == 2); | |
13241 ObjectHashTable* table = ObjectHashTable::cast(args[0]); | |
Michael Starzinger
2012/11/06 14:17:44
Use the CONVERT_ARG_CHECKED macro here which will
adamk
2012/11/06 14:54:21
Done.
| |
13242 Object* key = args[1]; | |
13243 Object* lookup = table->Lookup(key); | |
13244 return lookup->IsTheHole() ? isolate->heap()->undefined_value() : lookup; | |
13245 } | |
13246 | |
13247 | |
13248 RUNTIME_FUNCTION(MaybeObject*, Runtime_ObjectHashTableSet) { | |
13249 HandleScope scope(isolate); | |
13250 ASSERT(args.length() == 3); | |
13251 Handle<ObjectHashTable> table = args.at<ObjectHashTable>(0); | |
Michael Starzinger
2012/11/06 14:17:44
Likewise.
adamk
2012/11/06 14:54:21
Done.
| |
13252 Handle<Object> key = args.at<Object>(1); | |
13253 Handle<Object> value = args.at<Object>(2); | |
13254 PutIntoObjectHashTable(table, key, value); | |
13255 return isolate->heap()->undefined_value(); | |
13256 } | |
13257 | |
13258 | |
13259 RUNTIME_FUNCTION(MaybeObject*, Runtime_ObjectHashTableHas) { | |
13260 NoHandleAllocation ha; | |
13261 ASSERT(args.length() == 2); | |
13262 ObjectHashTable* table = ObjectHashTable::cast(args[0]); | |
Michael Starzinger
2012/11/06 14:17:44
Likewise.
adamk
2012/11/06 14:54:21
Done.
| |
13263 Object* key = args[1]; | |
13264 Object* lookup = table->Lookup(key); | |
13265 return isolate->heap()->ToBoolean(!lookup->IsTheHole()); | |
13266 } | |
13267 | |
13268 | |
13225 // ---------------------------------------------------------------------------- | 13269 // ---------------------------------------------------------------------------- |
13226 // Implementation of Runtime | 13270 // Implementation of Runtime |
13227 | 13271 |
13228 #define F(name, number_of_args, result_size) \ | 13272 #define F(name, number_of_args, result_size) \ |
13229 { Runtime::k##name, Runtime::RUNTIME, #name, \ | 13273 { Runtime::k##name, Runtime::RUNTIME, #name, \ |
13230 FUNCTION_ADDR(Runtime_##name), number_of_args, result_size }, | 13274 FUNCTION_ADDR(Runtime_##name), number_of_args, result_size }, |
13231 | 13275 |
13232 | 13276 |
13233 #define I(name, number_of_args, result_size) \ | 13277 #define I(name, number_of_args, result_size) \ |
13234 { Runtime::kInline##name, Runtime::INLINE, \ | 13278 { Runtime::kInline##name, Runtime::INLINE, \ |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13301 // Handle last resort GC and make sure to allow future allocations | 13345 // Handle last resort GC and make sure to allow future allocations |
13302 // to grow the heap without causing GCs (if possible). | 13346 // to grow the heap without causing GCs (if possible). |
13303 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13347 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13304 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13348 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13305 "Runtime::PerformGC"); | 13349 "Runtime::PerformGC"); |
13306 } | 13350 } |
13307 } | 13351 } |
13308 | 13352 |
13309 | 13353 |
13310 } } // namespace v8::internal | 13354 } } // namespace v8::internal |
OLD | NEW |