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 4670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4681 int f = FastD2IChecked(f_number); | 4681 int f = FastD2IChecked(f_number); |
4682 RUNTIME_ASSERT(f >= 1 && f <= 21); | 4682 RUNTIME_ASSERT(f >= 1 && f <= 21); |
4683 char* str = DoubleToPrecisionCString(value, f); | 4683 char* str = DoubleToPrecisionCString(value, f); |
4684 MaybeObject* res = | 4684 MaybeObject* res = |
4685 isolate->heap()->AllocateStringFromOneByte(CStrVector(str)); | 4685 isolate->heap()->AllocateStringFromOneByte(CStrVector(str)); |
4686 DeleteArray(str); | 4686 DeleteArray(str); |
4687 return res; | 4687 return res; |
4688 } | 4688 } |
4689 | 4689 |
4690 | 4690 |
| 4691 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsValidSmi) { |
| 4692 HandleScope shs(isolate); |
| 4693 ASSERT(args.length() == 1); |
| 4694 |
| 4695 CONVERT_NUMBER_CHECKED(int32_t, number, Int32, args[0]); |
| 4696 if (Smi::IsValid(number)) { |
| 4697 return isolate->heap()->true_value(); |
| 4698 } else { |
| 4699 return isolate->heap()->false_value(); |
| 4700 } |
| 4701 } |
| 4702 |
| 4703 |
4691 // Returns a single character string where first character equals | 4704 // Returns a single character string where first character equals |
4692 // string->Get(index). | 4705 // string->Get(index). |
4693 static Handle<Object> GetCharAt(Handle<String> string, uint32_t index) { | 4706 static Handle<Object> GetCharAt(Handle<String> string, uint32_t index) { |
4694 if (index < static_cast<uint32_t>(string->length())) { | 4707 if (index < static_cast<uint32_t>(string->length())) { |
4695 string->TryFlatten(); | 4708 string->TryFlatten(); |
4696 return LookupSingleCharacterStringFromCode( | 4709 return LookupSingleCharacterStringFromCode( |
4697 string->GetIsolate(), | 4710 string->GetIsolate(), |
4698 string->Get(index)); | 4711 string->Get(index)); |
4699 } | 4712 } |
4700 return Execution::CharAt(string, index); | 4713 return Execution::CharAt(string, index); |
(...skipping 9703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14404 // Handle last resort GC and make sure to allow future allocations | 14417 // Handle last resort GC and make sure to allow future allocations |
14405 // to grow the heap without causing GCs (if possible). | 14418 // to grow the heap without causing GCs (if possible). |
14406 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14419 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14407 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14420 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14408 "Runtime::PerformGC"); | 14421 "Runtime::PerformGC"); |
14409 } | 14422 } |
14410 } | 14423 } |
14411 | 14424 |
14412 | 14425 |
14413 } } // namespace v8::internal | 14426 } } // namespace v8::internal |
OLD | NEW |