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 12457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
12468 LOGGER->LogRuntime(chars, elms); | 12468 LOGGER->LogRuntime(chars, elms); |
12469 return isolate->heap()->undefined_value(); | 12469 return isolate->heap()->undefined_value(); |
12470 } | 12470 } |
12471 | 12471 |
12472 | 12472 |
12473 RUNTIME_FUNCTION(MaybeObject*, Runtime_IS_VAR) { | 12473 RUNTIME_FUNCTION(MaybeObject*, Runtime_IS_VAR) { |
12474 UNREACHABLE(); // implemented as macro in the parser | 12474 UNREACHABLE(); // implemented as macro in the parser |
12475 return NULL; | 12475 return NULL; |
12476 } | 12476 } |
12477 | 12477 |
12478 | 12478 |
Yang
2011/06/30 08:54:49
I hope adding yet another macro is alright. Saves
danno
2011/06/30 17:24:04
The macro is OK.
I would prefer to make this spec
| |
12479 #define OBJECT_HAS(Name) \ | |
12480 RUNTIME_FUNCTION(MaybeObject*, Runtime_Object##Name) { \ | |
12481 CONVERT_CHECKED(JSObject, obj, args[0]); \ | |
12482 return isolate->heap()->ToBoolean(obj->Name()); \ | |
12483 } | |
12484 | |
12485 OBJECT_HAS(HasFastElements) | |
12486 OBJECT_HAS(HasFastDoubleElements) | |
12487 OBJECT_HAS(HasDictionaryElements) | |
12488 OBJECT_HAS(HasExternalPixelElements) | |
12489 OBJECT_HAS(HasExternalArrayElements) | |
12490 OBJECT_HAS(HasExternalByteElements) | |
12491 OBJECT_HAS(HasExternalUnsignedByteElements) | |
12492 OBJECT_HAS(HasExternalShortElements) | |
12493 OBJECT_HAS(HasExternalUnsignedShortElements) | |
12494 OBJECT_HAS(HasExternalIntElements) | |
12495 OBJECT_HAS(HasExternalUnsignedIntElements) | |
12496 OBJECT_HAS(HasExternalFloatElements) | |
12497 OBJECT_HAS(HasExternalDoubleElements) | |
12498 | |
12499 #undef OBJECT_HAS | |
12500 | |
12479 // ---------------------------------------------------------------------------- | 12501 // ---------------------------------------------------------------------------- |
12480 // Implementation of Runtime | 12502 // Implementation of Runtime |
12481 | 12503 |
12482 #define F(name, number_of_args, result_size) \ | 12504 #define F(name, number_of_args, result_size) \ |
12483 { Runtime::k##name, Runtime::RUNTIME, #name, \ | 12505 { Runtime::k##name, Runtime::RUNTIME, #name, \ |
12484 FUNCTION_ADDR(Runtime_##name), number_of_args, result_size }, | 12506 FUNCTION_ADDR(Runtime_##name), number_of_args, result_size }, |
12485 | 12507 |
12486 | 12508 |
12487 #define I(name, number_of_args, result_size) \ | 12509 #define I(name, number_of_args, result_size) \ |
12488 { Runtime::kInline##name, Runtime::INLINE, \ | 12510 { Runtime::kInline##name, Runtime::INLINE, \ |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
12549 } else { | 12571 } else { |
12550 // Handle last resort GC and make sure to allow future allocations | 12572 // Handle last resort GC and make sure to allow future allocations |
12551 // to grow the heap without causing GCs (if possible). | 12573 // to grow the heap without causing GCs (if possible). |
12552 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12574 isolate->counters()->gc_last_resort_from_js()->Increment(); |
12553 isolate->heap()->CollectAllGarbage(false); | 12575 isolate->heap()->CollectAllGarbage(false); |
12554 } | 12576 } |
12555 } | 12577 } |
12556 | 12578 |
12557 | 12579 |
12558 } } // namespace v8::internal | 12580 } } // namespace v8::internal |
OLD | NEW |