| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 // slow properties mode for now. We don't go in the map cache because | 252 // slow properties mode for now. We don't go in the map cache because |
| 253 // maps with constant functions can't be shared if the functions are | 253 // maps with constant functions can't be shared if the functions are |
| 254 // not the same (which is the common case). | 254 // not the same (which is the common case). |
| 255 bool is_result_from_cache = false; | 255 bool is_result_from_cache = false; |
| 256 Handle<Map> map = has_function_literal | 256 Handle<Map> map = has_function_literal |
| 257 ? Handle<Map>(context->object_function()->initial_map()) | 257 ? Handle<Map>(context->object_function()->initial_map()) |
| 258 : ComputeObjectLiteralMap(context, | 258 : ComputeObjectLiteralMap(context, |
| 259 constant_properties, | 259 constant_properties, |
| 260 &is_result_from_cache); | 260 &is_result_from_cache); |
| 261 | 261 |
| 262 PretenureFlag pretenure_flag = |
| 263 isolate->heap()->InNewSpace(*literals) ? NOT_TENURED : TENURED; |
| 264 |
| 262 Handle<JSObject> boilerplate = | 265 Handle<JSObject> boilerplate = |
| 263 isolate->factory()->NewJSObjectFromMap( | 266 isolate->factory()->NewJSObjectFromMap(map, pretenure_flag); |
| 264 map, isolate->heap()->GetPretenureMode()); | |
| 265 | 267 |
| 266 // Normalize the elements of the boilerplate to save space if needed. | 268 // Normalize the elements of the boilerplate to save space if needed. |
| 267 if (!should_have_fast_elements) JSObject::NormalizeElements(boilerplate); | 269 if (!should_have_fast_elements) JSObject::NormalizeElements(boilerplate); |
| 268 | 270 |
| 269 // Add the constant properties to the boilerplate. | 271 // Add the constant properties to the boilerplate. |
| 270 int length = constant_properties->length(); | 272 int length = constant_properties->length(); |
| 271 bool should_transform = | 273 bool should_transform = |
| 272 !is_result_from_cache && boilerplate->HasFastProperties(); | 274 !is_result_from_cache && boilerplate->HasFastProperties(); |
| 273 if (should_transform || has_function_literal) { | 275 if (should_transform || has_function_literal) { |
| 274 // Normalize the properties of object to avoid n^2 behavior | 276 // Normalize the properties of object to avoid n^2 behavior |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 | 362 |
| 361 | 363 |
| 362 Handle<Object> Runtime::CreateArrayLiteralBoilerplate( | 364 Handle<Object> Runtime::CreateArrayLiteralBoilerplate( |
| 363 Isolate* isolate, | 365 Isolate* isolate, |
| 364 Handle<FixedArray> literals, | 366 Handle<FixedArray> literals, |
| 365 Handle<FixedArray> elements) { | 367 Handle<FixedArray> elements) { |
| 366 // Create the JSArray. | 368 // Create the JSArray. |
| 367 Handle<JSFunction> constructor( | 369 Handle<JSFunction> constructor( |
| 368 JSFunction::NativeContextFromLiterals(*literals)->array_function()); | 370 JSFunction::NativeContextFromLiterals(*literals)->array_function()); |
| 369 | 371 |
| 372 PretenureFlag pretenure_flag = |
| 373 isolate->heap()->InNewSpace(*literals) ? NOT_TENURED : TENURED; |
| 374 |
| 370 Handle<JSArray> object = Handle<JSArray>::cast( | 375 Handle<JSArray> object = Handle<JSArray>::cast( |
| 371 isolate->factory()->NewJSObject( | 376 isolate->factory()->NewJSObject(constructor, pretenure_flag)); |
| 372 constructor, isolate->heap()->GetPretenureMode())); | |
| 373 | 377 |
| 374 ElementsKind constant_elements_kind = | 378 ElementsKind constant_elements_kind = |
| 375 static_cast<ElementsKind>(Smi::cast(elements->get(0))->value()); | 379 static_cast<ElementsKind>(Smi::cast(elements->get(0))->value()); |
| 376 Handle<FixedArrayBase> constant_elements_values( | 380 Handle<FixedArrayBase> constant_elements_values( |
| 377 FixedArrayBase::cast(elements->get(1))); | 381 FixedArrayBase::cast(elements->get(1))); |
| 378 | 382 |
| 379 ASSERT(IsFastElementsKind(constant_elements_kind)); | 383 ASSERT(IsFastElementsKind(constant_elements_kind)); |
| 380 Context* native_context = isolate->context()->native_context(); | 384 Context* native_context = isolate->context()->native_context(); |
| 381 Object* maybe_maps_array = native_context->js_array_maps(); | 385 Object* maybe_maps_array = native_context->js_array_maps(); |
| 382 ASSERT(!maybe_maps_array->IsUndefined()); | 386 ASSERT(!maybe_maps_array->IsUndefined()); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 Handle<Object> name(args[0], isolate); | 626 Handle<Object> name(args[0], isolate); |
| 623 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); | 627 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); |
| 624 Symbol* symbol; | 628 Symbol* symbol; |
| 625 MaybeObject* maybe = isolate->heap()->AllocatePrivateSymbol(); | 629 MaybeObject* maybe = isolate->heap()->AllocatePrivateSymbol(); |
| 626 if (!maybe->To(&symbol)) return maybe; | 630 if (!maybe->To(&symbol)) return maybe; |
| 627 if (name->IsString()) symbol->set_name(*name); | 631 if (name->IsString()) symbol->set_name(*name); |
| 628 return symbol; | 632 return symbol; |
| 629 } | 633 } |
| 630 | 634 |
| 631 | 635 |
| 632 RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolName) { | 636 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewSymbolWrapper) { |
| 637 ASSERT(args.length() == 1); |
| 638 CONVERT_ARG_CHECKED(Symbol, symbol, 0); |
| 639 return symbol->ToObject(isolate); |
| 640 } |
| 641 |
| 642 |
| 643 RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolDescription) { |
| 633 SealHandleScope shs(isolate); | 644 SealHandleScope shs(isolate); |
| 634 ASSERT(args.length() == 1); | 645 ASSERT(args.length() == 1); |
| 635 CONVERT_ARG_CHECKED(Symbol, symbol, 0); | 646 CONVERT_ARG_CHECKED(Symbol, symbol, 0); |
| 636 return symbol->name(); | 647 return symbol->name(); |
| 637 } | 648 } |
| 638 | 649 |
| 639 | 650 |
| 640 RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolIsPrivate) { | 651 RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolIsPrivate) { |
| 641 SealHandleScope shs(isolate); | 652 SealHandleScope shs(isolate); |
| 642 ASSERT(args.length() == 1); | 653 ASSERT(args.length() == 1); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 CONVERT_ARG_CHECKED(Object, object, 0); | 870 CONVERT_ARG_CHECKED(Object, object, 0); |
| 860 return object->IsJSArrayBufferView() | 871 return object->IsJSArrayBufferView() |
| 861 ? isolate->heap()->true_value() | 872 ? isolate->heap()->true_value() |
| 862 : isolate->heap()->false_value(); | 873 : isolate->heap()->false_value(); |
| 863 } | 874 } |
| 864 | 875 |
| 865 | 876 |
| 866 void Runtime::ArrayIdToTypeAndSize( | 877 void Runtime::ArrayIdToTypeAndSize( |
| 867 int arrayId, ExternalArrayType* array_type, size_t* element_size) { | 878 int arrayId, ExternalArrayType* array_type, size_t* element_size) { |
| 868 switch (arrayId) { | 879 switch (arrayId) { |
| 869 case ARRAY_ID_UINT8: | 880 #define ARRAY_ID_CASE(Type, type, TYPE, ctype, size) \ |
| 870 *array_type = kExternalUnsignedByteArray; | 881 case ARRAY_ID_##TYPE: \ |
| 871 *element_size = 1; | 882 *array_type = kExternal##Type##Array; \ |
| 883 *element_size = size; \ |
| 872 break; | 884 break; |
| 873 case ARRAY_ID_INT8: | 885 |
| 874 *array_type = kExternalByteArray; | 886 TYPED_ARRAYS(ARRAY_ID_CASE) |
| 875 *element_size = 1; | 887 #undef ARRAY_ID_CASE |
| 876 break; | 888 |
| 877 case ARRAY_ID_UINT16: | |
| 878 *array_type = kExternalUnsignedShortArray; | |
| 879 *element_size = 2; | |
| 880 break; | |
| 881 case ARRAY_ID_INT16: | |
| 882 *array_type = kExternalShortArray; | |
| 883 *element_size = 2; | |
| 884 break; | |
| 885 case ARRAY_ID_UINT32: | |
| 886 *array_type = kExternalUnsignedIntArray; | |
| 887 *element_size = 4; | |
| 888 break; | |
| 889 case ARRAY_ID_INT32: | |
| 890 *array_type = kExternalIntArray; | |
| 891 *element_size = 4; | |
| 892 break; | |
| 893 case ARRAY_ID_FLOAT32: | |
| 894 *array_type = kExternalFloatArray; | |
| 895 *element_size = 4; | |
| 896 break; | |
| 897 case ARRAY_ID_FLOAT64: | |
| 898 *array_type = kExternalDoubleArray; | |
| 899 *element_size = 8; | |
| 900 break; | |
| 901 case ARRAY_ID_UINT8C: | |
| 902 *array_type = kExternalPixelArray; | |
| 903 *element_size = 1; | |
| 904 break; | |
| 905 default: | 889 default: |
| 906 UNREACHABLE(); | 890 UNREACHABLE(); |
| 907 } | 891 } |
| 908 } | 892 } |
| 909 | 893 |
| 910 | 894 |
| 911 RUNTIME_FUNCTION(MaybeObject*, Runtime_TypedArrayInitialize) { | 895 RUNTIME_FUNCTION(MaybeObject*, Runtime_TypedArrayInitialize) { |
| 912 HandleScope scope(isolate); | 896 HandleScope scope(isolate); |
| 913 ASSERT(args.length() == 5); | 897 ASSERT(args.length() == 5); |
| 914 CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, holder, 0); | 898 CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, holder, 0); |
| 915 CONVERT_SMI_ARG_CHECKED(arrayId, 1); | 899 CONVERT_SMI_ARG_CHECKED(arrayId, 1); |
| 916 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, buffer, 2); | 900 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, buffer, 2); |
| 917 CONVERT_ARG_HANDLE_CHECKED(Object, byte_offset_object, 3); | 901 CONVERT_ARG_HANDLE_CHECKED(Object, byte_offset_object, 3); |
| 918 CONVERT_ARG_HANDLE_CHECKED(Object, byte_length_object, 4); | 902 CONVERT_ARG_HANDLE_CHECKED(Object, byte_length_object, 4); |
| 919 | 903 |
| 920 ASSERT(holder->GetInternalFieldCount() == | 904 ASSERT(holder->GetInternalFieldCount() == |
| 921 v8::ArrayBufferView::kInternalFieldCount); | 905 v8::ArrayBufferView::kInternalFieldCount); |
| 922 for (int i = 0; i < v8::ArrayBufferView::kInternalFieldCount; i++) { | 906 for (int i = 0; i < v8::ArrayBufferView::kInternalFieldCount; i++) { |
| 923 holder->SetInternalField(i, Smi::FromInt(0)); | 907 holder->SetInternalField(i, Smi::FromInt(0)); |
| 924 } | 908 } |
| 925 | 909 |
| 926 ExternalArrayType array_type = kExternalByteArray; // Bogus initialization. | 910 ExternalArrayType array_type = kExternalInt8Array; // Bogus initialization. |
| 927 size_t element_size = 1; // Bogus initialization. | 911 size_t element_size = 1; // Bogus initialization. |
| 928 Runtime::ArrayIdToTypeAndSize(arrayId, &array_type, &element_size); | 912 Runtime::ArrayIdToTypeAndSize(arrayId, &array_type, &element_size); |
| 929 | 913 |
| 930 holder->set_buffer(*buffer); | 914 holder->set_buffer(*buffer); |
| 931 holder->set_byte_offset(*byte_offset_object); | 915 holder->set_byte_offset(*byte_offset_object); |
| 932 holder->set_byte_length(*byte_length_object); | 916 holder->set_byte_length(*byte_length_object); |
| 933 | 917 |
| 934 size_t byte_offset = NumberToSize(isolate, *byte_offset_object); | 918 size_t byte_offset = NumberToSize(isolate, *byte_offset_object); |
| 935 size_t byte_length = NumberToSize(isolate, *byte_length_object); | 919 size_t byte_length = NumberToSize(isolate, *byte_length_object); |
| 936 ASSERT(byte_length % element_size == 0); | 920 ASSERT(byte_length % element_size == 0); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 CONVERT_SMI_ARG_CHECKED(arrayId, 1); | 952 CONVERT_SMI_ARG_CHECKED(arrayId, 1); |
| 969 CONVERT_ARG_HANDLE_CHECKED(Object, source, 2); | 953 CONVERT_ARG_HANDLE_CHECKED(Object, source, 2); |
| 970 CONVERT_ARG_HANDLE_CHECKED(Object, length_obj, 3); | 954 CONVERT_ARG_HANDLE_CHECKED(Object, length_obj, 3); |
| 971 | 955 |
| 972 ASSERT(holder->GetInternalFieldCount() == | 956 ASSERT(holder->GetInternalFieldCount() == |
| 973 v8::ArrayBufferView::kInternalFieldCount); | 957 v8::ArrayBufferView::kInternalFieldCount); |
| 974 for (int i = 0; i < v8::ArrayBufferView::kInternalFieldCount; i++) { | 958 for (int i = 0; i < v8::ArrayBufferView::kInternalFieldCount; i++) { |
| 975 holder->SetInternalField(i, Smi::FromInt(0)); | 959 holder->SetInternalField(i, Smi::FromInt(0)); |
| 976 } | 960 } |
| 977 | 961 |
| 978 ExternalArrayType array_type = kExternalByteArray; // Bogus initialization. | 962 ExternalArrayType array_type = kExternalInt8Array; // Bogus initialization. |
| 979 size_t element_size = 1; // Bogus initialization. | 963 size_t element_size = 1; // Bogus initialization. |
| 980 Runtime::ArrayIdToTypeAndSize(arrayId, &array_type, &element_size); | 964 Runtime::ArrayIdToTypeAndSize(arrayId, &array_type, &element_size); |
| 981 | 965 |
| 982 Handle<JSArrayBuffer> buffer = isolate->factory()->NewJSArrayBuffer(); | 966 Handle<JSArrayBuffer> buffer = isolate->factory()->NewJSArrayBuffer(); |
| 983 size_t length = NumberToSize(isolate, *length_obj); | 967 size_t length = NumberToSize(isolate, *length_obj); |
| 984 | 968 |
| 985 if ((length > static_cast<unsigned>(Smi::kMaxValue)) || | 969 if ((length > static_cast<unsigned>(Smi::kMaxValue)) || |
| 986 (length > (kMaxInt / element_size))) { | 970 (length > (kMaxInt / element_size))) { |
| 987 return isolate->Throw(*isolate->factory()-> | 971 return isolate->Throw(*isolate->factory()-> |
| 988 NewRangeError("invalid_typed_array_length", | 972 NewRangeError("invalid_typed_array_length", |
| (...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2487 return *value; | 2471 return *value; |
| 2488 } | 2472 } |
| 2489 | 2473 |
| 2490 | 2474 |
| 2491 RUNTIME_FUNCTION(MaybeObject*, | 2475 RUNTIME_FUNCTION(MaybeObject*, |
| 2492 Runtime_OptimizeObjectForAddingMultipleProperties) { | 2476 Runtime_OptimizeObjectForAddingMultipleProperties) { |
| 2493 HandleScope scope(isolate); | 2477 HandleScope scope(isolate); |
| 2494 ASSERT(args.length() == 2); | 2478 ASSERT(args.length() == 2); |
| 2495 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 2479 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
| 2496 CONVERT_SMI_ARG_CHECKED(properties, 1); | 2480 CONVERT_SMI_ARG_CHECKED(properties, 1); |
| 2497 if (object->HasFastProperties()) { | 2481 if (object->HasFastProperties() && !object->IsJSGlobalProxy()) { |
| 2498 JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, properties); | 2482 JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, properties); |
| 2499 } | 2483 } |
| 2500 return *object; | 2484 return *object; |
| 2501 } | 2485 } |
| 2502 | 2486 |
| 2503 | 2487 |
| 2504 RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpExec) { | 2488 RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpExec) { |
| 2505 HandleScope scope(isolate); | 2489 HandleScope scope(isolate); |
| 2506 ASSERT(args.length() == 4); | 2490 ASSERT(args.length() == 4); |
| 2507 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0); | 2491 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0); |
| (...skipping 4049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6557 args, isolate, isolate->runtime_state()->to_lower_mapping()); | 6541 args, isolate, isolate->runtime_state()->to_lower_mapping()); |
| 6558 } | 6542 } |
| 6559 | 6543 |
| 6560 | 6544 |
| 6561 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringToUpperCase) { | 6545 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringToUpperCase) { |
| 6562 return ConvertCase( | 6546 return ConvertCase( |
| 6563 args, isolate, isolate->runtime_state()->to_upper_mapping()); | 6547 args, isolate, isolate->runtime_state()->to_upper_mapping()); |
| 6564 } | 6548 } |
| 6565 | 6549 |
| 6566 | 6550 |
| 6567 static inline bool IsTrimWhiteSpace(unibrow::uchar c) { | |
| 6568 return unibrow::WhiteSpace::Is(c) || c == 0x200b || c == 0xfeff; | |
| 6569 } | |
| 6570 | |
| 6571 | |
| 6572 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringTrim) { | 6551 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringTrim) { |
| 6573 HandleScope scope(isolate); | 6552 HandleScope scope(isolate); |
| 6574 ASSERT(args.length() == 3); | 6553 ASSERT(args.length() == 3); |
| 6575 | 6554 |
| 6576 CONVERT_ARG_HANDLE_CHECKED(String, string, 0); | 6555 CONVERT_ARG_HANDLE_CHECKED(String, string, 0); |
| 6577 CONVERT_BOOLEAN_ARG_CHECKED(trimLeft, 1); | 6556 CONVERT_BOOLEAN_ARG_CHECKED(trimLeft, 1); |
| 6578 CONVERT_BOOLEAN_ARG_CHECKED(trimRight, 2); | 6557 CONVERT_BOOLEAN_ARG_CHECKED(trimRight, 2); |
| 6579 | 6558 |
| 6580 string = FlattenGetString(string); | 6559 string = FlattenGetString(string); |
| 6581 int length = string->length(); | 6560 int length = string->length(); |
| 6582 | 6561 |
| 6583 int left = 0; | 6562 int left = 0; |
| 6563 UnicodeCache* unicode_cache = isolate->unicode_cache(); |
| 6584 if (trimLeft) { | 6564 if (trimLeft) { |
| 6585 while (left < length && IsTrimWhiteSpace(string->Get(left))) { | 6565 while (left < length && |
| 6566 unicode_cache->IsWhiteSpaceOrLineTerminator(string->Get(left))) { |
| 6586 left++; | 6567 left++; |
| 6587 } | 6568 } |
| 6588 } | 6569 } |
| 6589 | 6570 |
| 6590 int right = length; | 6571 int right = length; |
| 6591 if (trimRight) { | 6572 if (trimRight) { |
| 6592 while (right > left && IsTrimWhiteSpace(string->Get(right - 1))) { | 6573 while (right > left && |
| 6574 unicode_cache->IsWhiteSpaceOrLineTerminator( |
| 6575 string->Get(right - 1))) { |
| 6593 right--; | 6576 right--; |
| 6594 } | 6577 } |
| 6595 } | 6578 } |
| 6596 | 6579 |
| 6597 return *isolate->factory()->NewSubString(string, left, right); | 6580 return *isolate->factory()->NewSubString(string, left, right); |
| 6598 } | 6581 } |
| 6599 | 6582 |
| 6600 | 6583 |
| 6601 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringSplit) { | 6584 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringSplit) { |
| 6602 HandleScope handle_scope(isolate); | 6585 HandleScope handle_scope(isolate); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6802 } | 6785 } |
| 6803 | 6786 |
| 6804 | 6787 |
| 6805 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToStringSkipCache) { | 6788 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToStringSkipCache) { |
| 6806 SealHandleScope shs(isolate); | 6789 SealHandleScope shs(isolate); |
| 6807 ASSERT(args.length() == 1); | 6790 ASSERT(args.length() == 1); |
| 6808 | 6791 |
| 6809 Object* number = args[0]; | 6792 Object* number = args[0]; |
| 6810 RUNTIME_ASSERT(number->IsNumber()); | 6793 RUNTIME_ASSERT(number->IsNumber()); |
| 6811 | 6794 |
| 6812 return isolate->heap()->NumberToString( | 6795 return isolate->heap()->NumberToString(number, false); |
| 6813 number, false, isolate->heap()->GetPretenureMode()); | |
| 6814 } | 6796 } |
| 6815 | 6797 |
| 6816 | 6798 |
| 6817 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToInteger) { | 6799 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberToInteger) { |
| 6818 SealHandleScope shs(isolate); | 6800 SealHandleScope shs(isolate); |
| 6819 ASSERT(args.length() == 1); | 6801 ASSERT(args.length() == 1); |
| 6820 | 6802 |
| 6821 CONVERT_DOUBLE_ARG_CHECKED(number, 0); | 6803 CONVERT_DOUBLE_ARG_CHECKED(number, 0); |
| 6822 | 6804 |
| 6823 // We do not include 0 so that we don't have to treat +0 / -0 cases. | 6805 // We do not include 0 so that we don't have to treat +0 / -0 cases. |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7280 0, separator_length); | 7262 0, separator_length); |
| 7281 cursor += separator_length; | 7263 cursor += separator_length; |
| 7282 previous_separator_position++; | 7264 previous_separator_position++; |
| 7283 } | 7265 } |
| 7284 } | 7266 } |
| 7285 ASSERT(cursor <= buffer.length()); | 7267 ASSERT(cursor <= buffer.length()); |
| 7286 } | 7268 } |
| 7287 | 7269 |
| 7288 | 7270 |
| 7289 RUNTIME_FUNCTION(MaybeObject*, Runtime_SparseJoinWithSeparator) { | 7271 RUNTIME_FUNCTION(MaybeObject*, Runtime_SparseJoinWithSeparator) { |
| 7290 SealHandleScope shs(isolate); | 7272 HandleScope scope(isolate); |
| 7291 ASSERT(args.length() == 3); | 7273 ASSERT(args.length() == 3); |
| 7292 CONVERT_ARG_CHECKED(JSArray, elements_array, 0); | 7274 CONVERT_ARG_CHECKED(JSArray, elements_array, 0); |
| 7293 RUNTIME_ASSERT(elements_array->HasFastSmiOrObjectElements()); | 7275 RUNTIME_ASSERT(elements_array->HasFastSmiOrObjectElements()); |
| 7294 CONVERT_NUMBER_CHECKED(uint32_t, array_length, Uint32, args[1]); | 7276 CONVERT_NUMBER_CHECKED(uint32_t, array_length, Uint32, args[1]); |
| 7295 CONVERT_ARG_CHECKED(String, separator, 2); | 7277 CONVERT_ARG_CHECKED(String, separator, 2); |
| 7296 // elements_array is fast-mode JSarray of alternating positions | 7278 // elements_array is fast-mode JSarray of alternating positions |
| 7297 // (increasing order) and strings. | 7279 // (increasing order) and strings. |
| 7298 // array_length is length of original array (used to add separators); | 7280 // array_length is length of original array (used to add separators); |
| 7299 // separator is string to put between elements. Assumed to be non-empty. | 7281 // separator is string to put between elements. Assumed to be non-empty. |
| 7300 | 7282 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7340 overflow = true; | 7322 overflow = true; |
| 7341 } | 7323 } |
| 7342 } else { | 7324 } else { |
| 7343 // Nonempty separator and at least 2^31-1 separators necessary | 7325 // Nonempty separator and at least 2^31-1 separators necessary |
| 7344 // means that the string is too large to create. | 7326 // means that the string is too large to create. |
| 7345 STATIC_ASSERT(String::kMaxLength < 0x7fffffff); | 7327 STATIC_ASSERT(String::kMaxLength < 0x7fffffff); |
| 7346 overflow = true; | 7328 overflow = true; |
| 7347 } | 7329 } |
| 7348 } | 7330 } |
| 7349 if (overflow) { | 7331 if (overflow) { |
| 7350 // Throw OutOfMemory exception for creating too large a string. | 7332 // Throw an exception if the resulting string is too large. See |
| 7351 V8::FatalProcessOutOfMemory("Array join result too large."); | 7333 // https://code.google.com/p/chromium/issues/detail?id=336820 |
| 7334 // for details. |
| 7335 return isolate->Throw(*isolate->factory()-> |
| 7336 NewRangeError("invalid_string_length", |
| 7337 HandleVector<Object>(NULL, 0))); |
| 7352 } | 7338 } |
| 7353 | 7339 |
| 7354 if (is_ascii) { | 7340 if (is_ascii) { |
| 7355 MaybeObject* result_allocation = | 7341 MaybeObject* result_allocation = |
| 7356 isolate->heap()->AllocateRawOneByteString(string_length); | 7342 isolate->heap()->AllocateRawOneByteString(string_length); |
| 7357 if (result_allocation->IsFailure()) return result_allocation; | 7343 if (result_allocation->IsFailure()) return result_allocation; |
| 7358 SeqOneByteString* result_string = | 7344 SeqOneByteString* result_string = |
| 7359 SeqOneByteString::cast(result_allocation->ToObjectUnchecked()); | 7345 SeqOneByteString::cast(result_allocation->ToObjectUnchecked()); |
| 7360 JoinSparseArrayWithSeparator<uint8_t>(elements, | 7346 JoinSparseArrayWithSeparator<uint8_t>(elements, |
| 7361 elements_length, | 7347 elements_length, |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7661 } | 7647 } |
| 7662 { MaybeObject* maybe_obj = isolate->heap()->PrepareForCompare(y); | 7648 { MaybeObject* maybe_obj = isolate->heap()->PrepareForCompare(y); |
| 7663 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 7649 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 7664 } | 7650 } |
| 7665 | 7651 |
| 7666 return (x->IsFlat() && y->IsFlat()) ? FlatStringCompare(x, y) | 7652 return (x->IsFlat() && y->IsFlat()) ? FlatStringCompare(x, y) |
| 7667 : StringCharacterStreamCompare(isolate->runtime_state(), x, y); | 7653 : StringCharacterStreamCompare(isolate->runtime_state(), x, y); |
| 7668 } | 7654 } |
| 7669 | 7655 |
| 7670 | 7656 |
| 7671 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_acos) { | 7657 #define RUNTIME_UNARY_MATH(NAME) \ |
| 7672 SealHandleScope shs(isolate); | 7658 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_##NAME) { \ |
| 7673 ASSERT(args.length() == 1); | 7659 SealHandleScope shs(isolate); \ |
| 7674 isolate->counters()->math_acos()->Increment(); | 7660 ASSERT(args.length() == 1); \ |
| 7661 isolate->counters()->math_##NAME()->Increment(); \ |
| 7662 CONVERT_DOUBLE_ARG_CHECKED(x, 0); \ |
| 7663 return isolate->heap()->AllocateHeapNumber(std::NAME(x)); \ |
| 7664 } |
| 7675 | 7665 |
| 7676 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 7666 RUNTIME_UNARY_MATH(acos) |
| 7677 return isolate->heap()->AllocateHeapNumber(std::acos(x)); | 7667 RUNTIME_UNARY_MATH(asin) |
| 7668 RUNTIME_UNARY_MATH(atan) |
| 7669 RUNTIME_UNARY_MATH(log) |
| 7670 #undef RUNTIME_UNARY_MATH |
| 7671 |
| 7672 |
| 7673 // Cube root approximation, refer to: http://metamerist.com/cbrt/cbrt.htm |
| 7674 // Using initial approximation adapted from Kahan's cbrt and 4 iterations |
| 7675 // of Newton's method. |
| 7676 inline double CubeRootNewtonIteration(double approx, double x) { |
| 7677 return (1.0 / 3.0) * (x / (approx * approx) + 2 * approx); |
| 7678 } | 7678 } |
| 7679 | 7679 |
| 7680 | 7680 |
| 7681 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_asin) { | 7681 inline double CubeRoot(double x) { |
| 7682 SealHandleScope shs(isolate); | 7682 static const uint64_t magic = V8_2PART_UINT64_C(0x2A9F7893, 00000000); |
| 7683 ASSERT(args.length() == 1); | 7683 uint64_t xhigh = double_to_uint64(x); |
| 7684 isolate->counters()->math_asin()->Increment(); | 7684 double approx = uint64_to_double(xhigh / 3 + magic); |
| 7685 | 7685 |
| 7686 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 7686 approx = CubeRootNewtonIteration(approx, x); |
| 7687 return isolate->heap()->AllocateHeapNumber(std::asin(x)); | 7687 approx = CubeRootNewtonIteration(approx, x); |
| 7688 approx = CubeRootNewtonIteration(approx, x); |
| 7689 return CubeRootNewtonIteration(approx, x); |
| 7688 } | 7690 } |
| 7689 | 7691 |
| 7690 | 7692 |
| 7691 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_atan) { | 7693 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_cbrt) { |
| 7692 SealHandleScope shs(isolate); | 7694 SealHandleScope shs(isolate); |
| 7693 ASSERT(args.length() == 1); | 7695 ASSERT(args.length() == 1); |
| 7694 isolate->counters()->math_atan()->Increment(); | |
| 7695 | |
| 7696 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 7696 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 7697 return isolate->heap()->AllocateHeapNumber(std::atan(x)); | 7697 if (x == 0 || std::isinf(x)) return args[0]; |
| 7698 double result = (x > 0) ? CubeRoot(x) : -CubeRoot(-x); |
| 7699 return isolate->heap()->AllocateHeapNumber(result); |
| 7698 } | 7700 } |
| 7699 | 7701 |
| 7700 | 7702 |
| 7703 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_log1p) { |
| 7704 SealHandleScope shs(isolate); |
| 7705 ASSERT(args.length() == 1); |
| 7706 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 7707 |
| 7708 double x_abs = std::fabs(x); |
| 7709 // Use Taylor series to approximate. With y = x + 1; |
| 7710 // log(y) at 1 == log(1) + log'(1)(y-1)/1! + log''(1)(y-1)^2/2! + ... |
| 7711 // == 0 + x - x^2/2 + x^3/3 ... |
| 7712 // The closer x is to 0, the fewer terms are required. |
| 7713 static const double threshold_2 = 1.0 / 0x00800000; |
| 7714 static const double threshold_3 = 1.0 / 0x00008000; |
| 7715 static const double threshold_7 = 1.0 / 0x00000080; |
| 7716 |
| 7717 double result; |
| 7718 if (x_abs < threshold_2) { |
| 7719 result = x * (1.0/1.0 - x * 1.0/2.0); |
| 7720 } else if (x_abs < threshold_3) { |
| 7721 result = x * (1.0/1.0 - x * (1.0/2.0 - x * (1.0/3.0))); |
| 7722 } else if (x_abs < threshold_7) { |
| 7723 result = x * (1.0/1.0 - x * (1.0/2.0 - x * ( |
| 7724 1.0/3.0 - x * (1.0/4.0 - x * ( |
| 7725 1.0/5.0 - x * (1.0/6.0 - x * ( |
| 7726 1.0/7.0))))))); |
| 7727 } else { // Use regular log if not close enough to 0. |
| 7728 result = std::log(1.0 + x); |
| 7729 } |
| 7730 return isolate->heap()->AllocateHeapNumber(result); |
| 7731 } |
| 7732 |
| 7733 |
| 7734 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_expm1) { |
| 7735 SealHandleScope shs(isolate); |
| 7736 ASSERT(args.length() == 1); |
| 7737 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 7738 |
| 7739 double x_abs = std::fabs(x); |
| 7740 // Use Taylor series to approximate. |
| 7741 // exp(x) - 1 at 0 == -1 + exp(0) + exp'(0)*x/1! + exp''(0)*x^2/2! + ... |
| 7742 // == x/1! + x^2/2! + x^3/3! + ... |
| 7743 // The closer x is to 0, the fewer terms are required. |
| 7744 static const double threshold_2 = 1.0 / 0x00400000; |
| 7745 static const double threshold_3 = 1.0 / 0x00004000; |
| 7746 static const double threshold_6 = 1.0 / 0x00000040; |
| 7747 |
| 7748 double result; |
| 7749 if (x_abs < threshold_2) { |
| 7750 result = x * (1.0/1.0 + x * (1.0/2.0)); |
| 7751 } else if (x_abs < threshold_3) { |
| 7752 result = x * (1.0/1.0 + x * (1.0/2.0 + x * (1.0/6.0))); |
| 7753 } else if (x_abs < threshold_6) { |
| 7754 result = x * (1.0/1.0 + x * (1.0/2.0 + x * ( |
| 7755 1.0/6.0 + x * (1.0/24.0 + x * ( |
| 7756 1.0/120.0 + x * (1.0/720.0)))))); |
| 7757 } else { // Use regular exp if not close enough to 0. |
| 7758 result = std::exp(x) - 1.0; |
| 7759 } |
| 7760 return isolate->heap()->AllocateHeapNumber(result); |
| 7761 } |
| 7762 |
| 7763 |
| 7701 static const double kPiDividedBy4 = 0.78539816339744830962; | 7764 static const double kPiDividedBy4 = 0.78539816339744830962; |
| 7702 | 7765 |
| 7703 | 7766 |
| 7704 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_atan2) { | 7767 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_atan2) { |
| 7705 SealHandleScope shs(isolate); | 7768 SealHandleScope shs(isolate); |
| 7706 ASSERT(args.length() == 2); | 7769 ASSERT(args.length() == 2); |
| 7707 isolate->counters()->math_atan2()->Increment(); | 7770 isolate->counters()->math_atan2()->Increment(); |
| 7708 | 7771 |
| 7709 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 7772 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 7710 CONVERT_DOUBLE_ARG_CHECKED(y, 1); | 7773 CONVERT_DOUBLE_ARG_CHECKED(y, 1); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 7738 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_floor) { | 7801 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_floor) { |
| 7739 SealHandleScope shs(isolate); | 7802 SealHandleScope shs(isolate); |
| 7740 ASSERT(args.length() == 1); | 7803 ASSERT(args.length() == 1); |
| 7741 isolate->counters()->math_floor()->Increment(); | 7804 isolate->counters()->math_floor()->Increment(); |
| 7742 | 7805 |
| 7743 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 7806 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 7744 return isolate->heap()->NumberFromDouble(std::floor(x)); | 7807 return isolate->heap()->NumberFromDouble(std::floor(x)); |
| 7745 } | 7808 } |
| 7746 | 7809 |
| 7747 | 7810 |
| 7748 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_log) { | |
| 7749 SealHandleScope shs(isolate); | |
| 7750 ASSERT(args.length() == 1); | |
| 7751 isolate->counters()->math_log()->Increment(); | |
| 7752 | |
| 7753 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | |
| 7754 return isolate->heap()->AllocateHeapNumber(std::log(x)); | |
| 7755 } | |
| 7756 | |
| 7757 | |
| 7758 // Slow version of Math.pow. We check for fast paths for special cases. | 7811 // Slow version of Math.pow. We check for fast paths for special cases. |
| 7759 // Used if SSE2/VFP3 is not available. | 7812 // Used if SSE2/VFP3 is not available. |
| 7760 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_pow) { | 7813 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_pow) { |
| 7761 SealHandleScope shs(isolate); | 7814 SealHandleScope shs(isolate); |
| 7762 ASSERT(args.length() == 2); | 7815 ASSERT(args.length() == 2); |
| 7763 isolate->counters()->math_pow()->Increment(); | 7816 isolate->counters()->math_pow()->Increment(); |
| 7764 | 7817 |
| 7765 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 7818 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 7766 | 7819 |
| 7767 // If the second argument is a smi, it is much faster to call the | 7820 // If the second argument is a smi, it is much faster to call the |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7843 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_sqrt) { | 7896 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_sqrt) { |
| 7844 SealHandleScope shs(isolate); | 7897 SealHandleScope shs(isolate); |
| 7845 ASSERT(args.length() == 1); | 7898 ASSERT(args.length() == 1); |
| 7846 isolate->counters()->math_sqrt()->Increment(); | 7899 isolate->counters()->math_sqrt()->Increment(); |
| 7847 | 7900 |
| 7848 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 7901 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 7849 return isolate->heap()->AllocateHeapNumber(fast_sqrt(x)); | 7902 return isolate->heap()->AllocateHeapNumber(fast_sqrt(x)); |
| 7850 } | 7903 } |
| 7851 | 7904 |
| 7852 | 7905 |
| 7906 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_fround) { |
| 7907 SealHandleScope shs(isolate); |
| 7908 ASSERT(args.length() == 1); |
| 7909 |
| 7910 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 7911 float xf = static_cast<float>(x); |
| 7912 return isolate->heap()->AllocateHeapNumber(xf); |
| 7913 } |
| 7914 |
| 7915 |
| 7853 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateMakeDay) { | 7916 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateMakeDay) { |
| 7854 SealHandleScope shs(isolate); | 7917 SealHandleScope shs(isolate); |
| 7855 ASSERT(args.length() == 2); | 7918 ASSERT(args.length() == 2); |
| 7856 | 7919 |
| 7857 CONVERT_SMI_ARG_CHECKED(year, 0); | 7920 CONVERT_SMI_ARG_CHECKED(year, 0); |
| 7858 CONVERT_SMI_ARG_CHECKED(month, 1); | 7921 CONVERT_SMI_ARG_CHECKED(month, 1); |
| 7859 | 7922 |
| 7860 return Smi::FromInt(isolate->date_cache()->DaysFromYearMonth(year, month)); | 7923 return Smi::FromInt(isolate->date_cache()->DaysFromYearMonth(year, month)); |
| 7861 } | 7924 } |
| 7862 | 7925 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8066 int prefix_argc, | 8129 int prefix_argc, |
| 8067 int* total_argc) { | 8130 int* total_argc) { |
| 8068 // Find frame containing arguments passed to the caller. | 8131 // Find frame containing arguments passed to the caller. |
| 8069 JavaScriptFrameIterator it(isolate); | 8132 JavaScriptFrameIterator it(isolate); |
| 8070 JavaScriptFrame* frame = it.frame(); | 8133 JavaScriptFrame* frame = it.frame(); |
| 8071 List<JSFunction*> functions(2); | 8134 List<JSFunction*> functions(2); |
| 8072 frame->GetFunctions(&functions); | 8135 frame->GetFunctions(&functions); |
| 8073 if (functions.length() > 1) { | 8136 if (functions.length() > 1) { |
| 8074 int inlined_jsframe_index = functions.length() - 1; | 8137 int inlined_jsframe_index = functions.length() - 1; |
| 8075 JSFunction* inlined_function = functions[inlined_jsframe_index]; | 8138 JSFunction* inlined_function = functions[inlined_jsframe_index]; |
| 8076 Vector<SlotRef> args_slots = | 8139 SlotRefValueBuilder slot_refs( |
| 8077 SlotRef::ComputeSlotMappingForArguments( | 8140 frame, |
| 8078 frame, | 8141 inlined_jsframe_index, |
| 8079 inlined_jsframe_index, | 8142 inlined_function->shared()->formal_parameter_count()); |
| 8080 inlined_function->shared()->formal_parameter_count()); | |
| 8081 | 8143 |
| 8082 int args_count = args_slots.length(); | 8144 int args_count = slot_refs.args_length(); |
| 8083 | 8145 |
| 8084 *total_argc = prefix_argc + args_count; | 8146 *total_argc = prefix_argc + args_count; |
| 8085 SmartArrayPointer<Handle<Object> > param_data( | 8147 SmartArrayPointer<Handle<Object> > param_data( |
| 8086 NewArray<Handle<Object> >(*total_argc)); | 8148 NewArray<Handle<Object> >(*total_argc)); |
| 8149 slot_refs.Prepare(isolate); |
| 8087 for (int i = 0; i < args_count; i++) { | 8150 for (int i = 0; i < args_count; i++) { |
| 8088 Handle<Object> val = args_slots[i].GetValue(isolate); | 8151 Handle<Object> val = slot_refs.GetNext(isolate, 0); |
| 8089 param_data[prefix_argc + i] = val; | 8152 param_data[prefix_argc + i] = val; |
| 8090 } | 8153 } |
| 8091 | 8154 slot_refs.Finish(isolate); |
| 8092 args_slots.Dispose(); | |
| 8093 | 8155 |
| 8094 return param_data; | 8156 return param_data; |
| 8095 } else { | 8157 } else { |
| 8096 it.AdvanceToArgumentsFrame(); | 8158 it.AdvanceToArgumentsFrame(); |
| 8097 frame = it.frame(); | 8159 frame = it.frame(); |
| 8098 int args_count = frame->ComputeParametersCount(); | 8160 int args_count = frame->ComputeParametersCount(); |
| 8099 | 8161 |
| 8100 *total_argc = prefix_argc + args_count; | 8162 *total_argc = prefix_argc + args_count; |
| 8101 SmartArrayPointer<Handle<Object> > param_data( | 8163 SmartArrayPointer<Handle<Object> > param_data( |
| 8102 NewArray<Handle<Object> >(*total_argc)); | 8164 NewArray<Handle<Object> >(*total_argc)); |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8454 isolate->thread_manager()->IterateArchivedThreads(&activations_finder); | 8516 isolate->thread_manager()->IterateArchivedThreads(&activations_finder); |
| 8455 | 8517 |
| 8456 if (!activations_finder.has_code_activations_) { | 8518 if (!activations_finder.has_code_activations_) { |
| 8457 if (function->code() == *optimized_code) { | 8519 if (function->code() == *optimized_code) { |
| 8458 if (FLAG_trace_deopt) { | 8520 if (FLAG_trace_deopt) { |
| 8459 PrintF("[removing optimized code for: "); | 8521 PrintF("[removing optimized code for: "); |
| 8460 function->PrintName(); | 8522 function->PrintName(); |
| 8461 PrintF("]\n"); | 8523 PrintF("]\n"); |
| 8462 } | 8524 } |
| 8463 function->ReplaceCode(function->shared()->code()); | 8525 function->ReplaceCode(function->shared()->code()); |
| 8526 // Evict optimized code for this function from the cache so that it |
| 8527 // doesn't get used for new closures. |
| 8528 function->shared()->EvictFromOptimizedCodeMap(*optimized_code, |
| 8529 "notify deoptimized"); |
| 8464 } | 8530 } |
| 8465 } else { | 8531 } else { |
| 8466 // TODO(titzer): we should probably do DeoptimizeCodeList(code) | 8532 // TODO(titzer): we should probably do DeoptimizeCodeList(code) |
| 8467 // unconditionally if the code is not already marked for deoptimization. | 8533 // unconditionally if the code is not already marked for deoptimization. |
| 8468 // If there is an index by shared function info, all the better. | 8534 // If there is an index by shared function info, all the better. |
| 8469 Deoptimizer::DeoptimizeFunction(*function); | 8535 Deoptimizer::DeoptimizeFunction(*function); |
| 8470 } | 8536 } |
| 8471 // Evict optimized code for this function from the cache so that it doesn't | |
| 8472 // get used for new closures. | |
| 8473 function->shared()->EvictFromOptimizedCodeMap(*optimized_code, | |
| 8474 "notify deoptimized"); | |
| 8475 | 8537 |
| 8476 return isolate->heap()->undefined_value(); | 8538 return isolate->heap()->undefined_value(); |
| 8477 } | 8539 } |
| 8478 | 8540 |
| 8479 | 8541 |
| 8480 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeoptimizeFunction) { | 8542 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeoptimizeFunction) { |
| 8481 HandleScope scope(isolate); | 8543 HandleScope scope(isolate); |
| 8482 ASSERT(args.length() == 1); | 8544 ASSERT(args.length() == 1); |
| 8483 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8545 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
| 8484 if (!function->IsOptimized()) return isolate->heap()->undefined_value(); | 8546 if (!function->IsOptimized()) return isolate->heap()->undefined_value(); |
| 8485 | 8547 |
| 8486 Deoptimizer::DeoptimizeFunction(*function); | 8548 Deoptimizer::DeoptimizeFunction(*function); |
| 8487 | 8549 |
| 8488 return isolate->heap()->undefined_value(); | 8550 return isolate->heap()->undefined_value(); |
| 8489 } | 8551 } |
| 8490 | 8552 |
| 8491 | 8553 |
| 8492 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearFunctionTypeFeedback) { | 8554 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearFunctionTypeFeedback) { |
| 8493 HandleScope scope(isolate); | 8555 HandleScope scope(isolate); |
| 8494 ASSERT(args.length() == 1); | 8556 ASSERT(args.length() == 1); |
| 8495 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8557 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
| 8496 Code* unoptimized = function->shared()->code(); | 8558 Code* unoptimized = function->shared()->code(); |
| 8497 if (unoptimized->kind() == Code::FUNCTION) { | 8559 if (unoptimized->kind() == Code::FUNCTION) { |
| 8498 unoptimized->ClearInlineCaches(); | 8560 unoptimized->ClearInlineCaches(); |
| 8499 unoptimized->ClearTypeFeedbackCells(isolate->heap()); | 8561 unoptimized->ClearTypeFeedbackInfo(isolate->heap()); |
| 8500 } | 8562 } |
| 8501 return isolate->heap()->undefined_value(); | 8563 return isolate->heap()->undefined_value(); |
| 8502 } | 8564 } |
| 8503 | 8565 |
| 8504 | 8566 |
| 8505 RUNTIME_FUNCTION(MaybeObject*, Runtime_RunningInSimulator) { | 8567 RUNTIME_FUNCTION(MaybeObject*, Runtime_RunningInSimulator) { |
| 8506 SealHandleScope shs(isolate); | 8568 SealHandleScope shs(isolate); |
| 8507 #if defined(USE_SIMULATOR) | 8569 #if defined(USE_SIMULATOR) |
| 8508 return isolate->heap()->true_value(); | 8570 return isolate->heap()->true_value(); |
| 8509 #else | 8571 #else |
| 8510 return isolate->heap()->false_value(); | 8572 return isolate->heap()->false_value(); |
| 8511 #endif | 8573 #endif |
| 8512 } | 8574 } |
| 8513 | 8575 |
| 8514 | 8576 |
| 8515 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsConcurrentRecompilationSupported) { | 8577 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsConcurrentRecompilationSupported) { |
| 8516 HandleScope scope(isolate); | 8578 HandleScope scope(isolate); |
| 8517 return isolate->concurrent_recompilation_enabled() | 8579 return isolate->concurrent_recompilation_enabled() |
| 8518 ? isolate->heap()->true_value() : isolate->heap()->false_value(); | 8580 ? isolate->heap()->true_value() : isolate->heap()->false_value(); |
| 8519 } | 8581 } |
| 8520 | 8582 |
| 8521 | 8583 |
| 8522 RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) { | 8584 RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) { |
| 8523 HandleScope scope(isolate); | 8585 HandleScope scope(isolate); |
| 8524 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); | 8586 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); |
| 8525 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8587 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
| 8526 | 8588 |
| 8527 if (!function->IsOptimizable()) return isolate->heap()->undefined_value(); | 8589 if (!function->IsOptimizable() && |
| 8590 !function->IsMarkedForConcurrentOptimization() && |
| 8591 !function->IsInOptimizationQueue()) { |
| 8592 return isolate->heap()->undefined_value(); |
| 8593 } |
| 8594 |
| 8528 function->MarkForOptimization(); | 8595 function->MarkForOptimization(); |
| 8529 | 8596 |
| 8530 Code* unoptimized = function->shared()->code(); | 8597 Code* unoptimized = function->shared()->code(); |
| 8531 if (args.length() == 2 && | 8598 if (args.length() == 2 && |
| 8532 unoptimized->kind() == Code::FUNCTION) { | 8599 unoptimized->kind() == Code::FUNCTION) { |
| 8533 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); | 8600 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); |
| 8534 if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("osr"))) { | 8601 if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("osr"))) { |
| 8535 // Start patching from the currently patched loop nesting level. | 8602 // Start patching from the currently patched loop nesting level. |
| 8536 int current_level = unoptimized->allow_osr_at_loop_nesting_level(); | 8603 int current_level = unoptimized->allow_osr_at_loop_nesting_level(); |
| 8537 ASSERT(BackEdgeTable::Verify(isolate, unoptimized, current_level)); | 8604 ASSERT(BackEdgeTable::Verify(isolate, unoptimized, current_level)); |
| 8538 for (int i = current_level + 1; i <= Code::kMaxLoopNestingMarker; i++) { | 8605 for (int i = current_level + 1; i <= Code::kMaxLoopNestingMarker; i++) { |
| 8539 unoptimized->set_allow_osr_at_loop_nesting_level(i); | 8606 unoptimized->set_allow_osr_at_loop_nesting_level(i); |
| 8540 isolate->runtime_profiler()->AttemptOnStackReplacement(*function); | 8607 isolate->runtime_profiler()->AttemptOnStackReplacement(*function); |
| 8541 } | 8608 } |
| 8542 } else if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("concurrent")) && | 8609 } else if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("concurrent")) && |
| 8543 isolate->concurrent_recompilation_enabled()) { | 8610 isolate->concurrent_recompilation_enabled()) { |
| 8544 function->MarkForConcurrentOptimization(); | 8611 function->MarkForConcurrentOptimization(); |
| 8545 } | 8612 } |
| 8546 } | 8613 } |
| 8547 | 8614 |
| 8548 return isolate->heap()->undefined_value(); | 8615 return isolate->heap()->undefined_value(); |
| 8549 } | 8616 } |
| 8550 | 8617 |
| 8551 | 8618 |
| 8552 RUNTIME_FUNCTION(MaybeObject*, Runtime_NeverOptimizeFunction) { | 8619 RUNTIME_FUNCTION(MaybeObject*, Runtime_NeverOptimizeFunction) { |
| 8553 HandleScope scope(isolate); | 8620 HandleScope scope(isolate); |
| 8554 ASSERT(args.length() == 1); | 8621 ASSERT(args.length() == 1); |
| 8555 CONVERT_ARG_CHECKED(JSFunction, function, 0); | 8622 CONVERT_ARG_CHECKED(JSFunction, function, 0); |
| 8556 ASSERT(!function->IsOptimized()); | |
| 8557 function->shared()->set_optimization_disabled(true); | 8623 function->shared()->set_optimization_disabled(true); |
| 8558 return isolate->heap()->undefined_value(); | 8624 return isolate->heap()->undefined_value(); |
| 8559 } | 8625 } |
| 8560 | 8626 |
| 8561 | 8627 |
| 8562 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) { | 8628 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) { |
| 8563 HandleScope scope(isolate); | 8629 HandleScope scope(isolate); |
| 8564 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); | 8630 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); |
| 8565 if (!isolate->use_crankshaft()) { | 8631 if (!isolate->use_crankshaft()) { |
| 8566 return Smi::FromInt(4); // 4 == "never". | 8632 return Smi::FromInt(4); // 4 == "never". |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8734 PrintF(" at AST id %d]\n", ast_id.ToInt()); | 8800 PrintF(" at AST id %d]\n", ast_id.ToInt()); |
| 8735 } | 8801 } |
| 8736 | 8802 |
| 8737 function->ReplaceCode(function->shared()->code()); | 8803 function->ReplaceCode(function->shared()->code()); |
| 8738 return NULL; | 8804 return NULL; |
| 8739 } | 8805 } |
| 8740 | 8806 |
| 8741 | 8807 |
| 8742 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetAllocationTimeout) { | 8808 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetAllocationTimeout) { |
| 8743 SealHandleScope shs(isolate); | 8809 SealHandleScope shs(isolate); |
| 8744 ASSERT(args.length() == 2); | 8810 ASSERT(args.length() == 2 || args.length() == 3); |
| 8745 #ifdef DEBUG | 8811 #ifdef DEBUG |
| 8746 CONVERT_SMI_ARG_CHECKED(interval, 0); | 8812 CONVERT_SMI_ARG_CHECKED(interval, 0); |
| 8747 CONVERT_SMI_ARG_CHECKED(timeout, 1); | 8813 CONVERT_SMI_ARG_CHECKED(timeout, 1); |
| 8748 isolate->heap()->set_allocation_timeout(timeout); | 8814 isolate->heap()->set_allocation_timeout(timeout); |
| 8749 FLAG_gc_interval = interval; | 8815 FLAG_gc_interval = interval; |
| 8816 if (args.length() == 3) { |
| 8817 // Enable/disable inline allocation if requested. |
| 8818 CONVERT_BOOLEAN_ARG_CHECKED(inline_allocation, 2); |
| 8819 if (inline_allocation) { |
| 8820 isolate->heap()->EnableInlineAllocation(); |
| 8821 } else { |
| 8822 isolate->heap()->DisableInlineAllocation(); |
| 8823 } |
| 8824 } |
| 8750 #endif | 8825 #endif |
| 8751 return isolate->heap()->undefined_value(); | 8826 return isolate->heap()->undefined_value(); |
| 8752 } | 8827 } |
| 8753 | 8828 |
| 8754 | 8829 |
| 8755 RUNTIME_FUNCTION(MaybeObject*, Runtime_CheckIsBootstrapping) { | 8830 RUNTIME_FUNCTION(MaybeObject*, Runtime_CheckIsBootstrapping) { |
| 8756 SealHandleScope shs(isolate); | 8831 SealHandleScope shs(isolate); |
| 8757 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive()); | 8832 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive()); |
| 8758 return isolate->heap()->undefined_value(); | 8833 return isolate->heap()->undefined_value(); |
| 8759 } | 8834 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8859 | 8934 |
| 8860 CONVERT_ARG_CHECKED(JSFunction, function, 0); | 8935 CONVERT_ARG_CHECKED(JSFunction, function, 0); |
| 8861 CONVERT_ARG_CHECKED(ScopeInfo, scope_info, 1); | 8936 CONVERT_ARG_CHECKED(ScopeInfo, scope_info, 1); |
| 8862 Context* result; | 8937 Context* result; |
| 8863 MaybeObject* maybe_result = | 8938 MaybeObject* maybe_result = |
| 8864 isolate->heap()->AllocateGlobalContext(function, scope_info); | 8939 isolate->heap()->AllocateGlobalContext(function, scope_info); |
| 8865 if (!maybe_result->To(&result)) return maybe_result; | 8940 if (!maybe_result->To(&result)) return maybe_result; |
| 8866 | 8941 |
| 8867 ASSERT(function->context() == isolate->context()); | 8942 ASSERT(function->context() == isolate->context()); |
| 8868 ASSERT(function->context()->global_object() == result->global_object()); | 8943 ASSERT(function->context()->global_object() == result->global_object()); |
| 8869 isolate->set_context(result); | |
| 8870 result->global_object()->set_global_context(result); | 8944 result->global_object()->set_global_context(result); |
| 8871 | 8945 |
| 8872 return result; // non-failure | 8946 return result; // non-failure |
| 8873 } | 8947 } |
| 8874 | 8948 |
| 8875 | 8949 |
| 8876 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewFunctionContext) { | 8950 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewFunctionContext) { |
| 8877 SealHandleScope shs(isolate); | 8951 SealHandleScope shs(isolate); |
| 8878 ASSERT(args.length() == 1); | 8952 ASSERT(args.length() == 1); |
| 8879 | 8953 |
| 8880 CONVERT_ARG_CHECKED(JSFunction, function, 0); | 8954 CONVERT_ARG_CHECKED(JSFunction, function, 0); |
| 8881 int length = function->shared()->scope_info()->ContextLength(); | 8955 int length = function->shared()->scope_info()->ContextLength(); |
| 8882 Context* result; | 8956 return isolate->heap()->AllocateFunctionContext(length, function); |
| 8883 MaybeObject* maybe_result = | |
| 8884 isolate->heap()->AllocateFunctionContext(length, function); | |
| 8885 if (!maybe_result->To(&result)) return maybe_result; | |
| 8886 | |
| 8887 isolate->set_context(result); | |
| 8888 | |
| 8889 return result; // non-failure | |
| 8890 } | 8957 } |
| 8891 | 8958 |
| 8892 | 8959 |
| 8893 RUNTIME_FUNCTION(MaybeObject*, Runtime_PushWithContext) { | 8960 RUNTIME_FUNCTION(MaybeObject*, Runtime_PushWithContext) { |
| 8894 SealHandleScope shs(isolate); | 8961 SealHandleScope shs(isolate); |
| 8895 ASSERT(args.length() == 2); | 8962 ASSERT(args.length() == 2); |
| 8896 JSReceiver* extension_object; | 8963 JSReceiver* extension_object; |
| 8897 if (args[0]->IsJSReceiver()) { | 8964 if (args[0]->IsJSReceiver()) { |
| 8898 extension_object = JSReceiver::cast(args[0]); | 8965 extension_object = JSReceiver::cast(args[0]); |
| 8899 } else { | 8966 } else { |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9755 | 9822 |
| 9756 // Allocate a block of memory in the given space (filled with a filler). | 9823 // Allocate a block of memory in the given space (filled with a filler). |
| 9757 // Used as a fall-back for generated code when the space is full. | 9824 // Used as a fall-back for generated code when the space is full. |
| 9758 static MaybeObject* Allocate(Isolate* isolate, | 9825 static MaybeObject* Allocate(Isolate* isolate, |
| 9759 int size, | 9826 int size, |
| 9760 bool double_align, | 9827 bool double_align, |
| 9761 AllocationSpace space) { | 9828 AllocationSpace space) { |
| 9762 Heap* heap = isolate->heap(); | 9829 Heap* heap = isolate->heap(); |
| 9763 RUNTIME_ASSERT(IsAligned(size, kPointerSize)); | 9830 RUNTIME_ASSERT(IsAligned(size, kPointerSize)); |
| 9764 RUNTIME_ASSERT(size > 0); | 9831 RUNTIME_ASSERT(size > 0); |
| 9765 RUNTIME_ASSERT(size <= heap->MaxRegularSpaceAllocationSize()); | 9832 RUNTIME_ASSERT(size <= Page::kMaxRegularHeapObjectSize); |
| 9766 HeapObject* allocation; | 9833 HeapObject* allocation; |
| 9767 { MaybeObject* maybe_allocation = heap->AllocateRaw(size, space, space); | 9834 { MaybeObject* maybe_allocation = heap->AllocateRaw(size, space, space); |
| 9768 if (!maybe_allocation->To(&allocation)) return maybe_allocation; | 9835 if (!maybe_allocation->To(&allocation)) return maybe_allocation; |
| 9769 } | 9836 } |
| 9770 #ifdef DEBUG | 9837 #ifdef DEBUG |
| 9771 MemoryChunk* chunk = MemoryChunk::FromAddress(allocation->address()); | 9838 MemoryChunk* chunk = MemoryChunk::FromAddress(allocation->address()); |
| 9772 ASSERT(chunk->owner()->identity() == space); | 9839 ASSERT(chunk->owner()->identity() == space); |
| 9773 #endif | 9840 #endif |
| 9774 heap->CreateFillerObjectAt(allocation->address(), size); | 9841 heap->CreateFillerObjectAt(allocation->address(), size); |
| 9775 return allocation; | 9842 return allocation; |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9992 int capacity = dictionary->Capacity(); | 10059 int capacity = dictionary->Capacity(); |
| 9993 for (int i = 0; i < capacity; i++) { | 10060 for (int i = 0; i < capacity; i++) { |
| 9994 Handle<Object> key(dictionary->KeyAt(i), array->GetIsolate()); | 10061 Handle<Object> key(dictionary->KeyAt(i), array->GetIsolate()); |
| 9995 if (dictionary->IsKey(*key)) { | 10062 if (dictionary->IsKey(*key)) { |
| 9996 element_count++; | 10063 element_count++; |
| 9997 } | 10064 } |
| 9998 } | 10065 } |
| 9999 break; | 10066 break; |
| 10000 } | 10067 } |
| 10001 case NON_STRICT_ARGUMENTS_ELEMENTS: | 10068 case NON_STRICT_ARGUMENTS_ELEMENTS: |
| 10002 case EXTERNAL_BYTE_ELEMENTS: | 10069 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
| 10003 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 10070 case EXTERNAL_##TYPE##_ELEMENTS: \ |
| 10004 case EXTERNAL_SHORT_ELEMENTS: | 10071 case TYPE##_ELEMENTS: \ |
| 10005 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 10072 |
| 10006 case EXTERNAL_INT_ELEMENTS: | 10073 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
| 10007 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 10074 #undef TYPED_ARRAY_CASE |
| 10008 case EXTERNAL_FLOAT_ELEMENTS: | |
| 10009 case EXTERNAL_DOUBLE_ELEMENTS: | |
| 10010 case EXTERNAL_PIXEL_ELEMENTS: | |
| 10011 case UINT8_ELEMENTS: | |
| 10012 case INT8_ELEMENTS: | |
| 10013 case UINT16_ELEMENTS: | |
| 10014 case INT16_ELEMENTS: | |
| 10015 case UINT32_ELEMENTS: | |
| 10016 case INT32_ELEMENTS: | |
| 10017 case FLOAT32_ELEMENTS: | |
| 10018 case FLOAT64_ELEMENTS: | |
| 10019 case UINT8_CLAMPED_ELEMENTS: | |
| 10020 // External arrays are always dense. | 10075 // External arrays are always dense. |
| 10021 return length; | 10076 return length; |
| 10022 } | 10077 } |
| 10023 // As an estimate, we assume that the prototype doesn't contain any | 10078 // As an estimate, we assume that the prototype doesn't contain any |
| 10024 // inherited elements. | 10079 // inherited elements. |
| 10025 return element_count; | 10080 return element_count; |
| 10026 } | 10081 } |
| 10027 | 10082 |
| 10028 | 10083 |
| 10029 | 10084 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10117 if (index < range) { | 10172 if (index < range) { |
| 10118 indices->Add(index); | 10173 indices->Add(index); |
| 10119 } | 10174 } |
| 10120 } | 10175 } |
| 10121 } | 10176 } |
| 10122 break; | 10177 break; |
| 10123 } | 10178 } |
| 10124 default: { | 10179 default: { |
| 10125 int dense_elements_length; | 10180 int dense_elements_length; |
| 10126 switch (kind) { | 10181 switch (kind) { |
| 10127 case EXTERNAL_PIXEL_ELEMENTS: { | 10182 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
| 10128 dense_elements_length = | 10183 case EXTERNAL_##TYPE##_ELEMENTS: { \ |
| 10129 ExternalPixelArray::cast(object->elements())->length(); | 10184 dense_elements_length = \ |
| 10130 break; | 10185 External##Type##Array::cast(object->elements())->length(); \ |
| 10186 break; \ |
| 10131 } | 10187 } |
| 10132 case EXTERNAL_BYTE_ELEMENTS: { | 10188 |
| 10133 dense_elements_length = | 10189 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
| 10134 ExternalByteArray::cast(object->elements())->length(); | 10190 #undef TYPED_ARRAY_CASE |
| 10135 break; | 10191 |
| 10136 } | |
| 10137 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: { | |
| 10138 dense_elements_length = | |
| 10139 ExternalUnsignedByteArray::cast(object->elements())->length(); | |
| 10140 break; | |
| 10141 } | |
| 10142 case EXTERNAL_SHORT_ELEMENTS: { | |
| 10143 dense_elements_length = | |
| 10144 ExternalShortArray::cast(object->elements())->length(); | |
| 10145 break; | |
| 10146 } | |
| 10147 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: { | |
| 10148 dense_elements_length = | |
| 10149 ExternalUnsignedShortArray::cast(object->elements())->length(); | |
| 10150 break; | |
| 10151 } | |
| 10152 case EXTERNAL_INT_ELEMENTS: { | |
| 10153 dense_elements_length = | |
| 10154 ExternalIntArray::cast(object->elements())->length(); | |
| 10155 break; | |
| 10156 } | |
| 10157 case EXTERNAL_UNSIGNED_INT_ELEMENTS: { | |
| 10158 dense_elements_length = | |
| 10159 ExternalUnsignedIntArray::cast(object->elements())->length(); | |
| 10160 break; | |
| 10161 } | |
| 10162 case EXTERNAL_FLOAT_ELEMENTS: { | |
| 10163 dense_elements_length = | |
| 10164 ExternalFloatArray::cast(object->elements())->length(); | |
| 10165 break; | |
| 10166 } | |
| 10167 case EXTERNAL_DOUBLE_ELEMENTS: { | |
| 10168 dense_elements_length = | |
| 10169 ExternalDoubleArray::cast(object->elements())->length(); | |
| 10170 break; | |
| 10171 } | |
| 10172 default: | 10192 default: |
| 10173 UNREACHABLE(); | 10193 UNREACHABLE(); |
| 10174 dense_elements_length = 0; | 10194 dense_elements_length = 0; |
| 10175 break; | 10195 break; |
| 10176 } | 10196 } |
| 10177 uint32_t length = static_cast<uint32_t>(dense_elements_length); | 10197 uint32_t length = static_cast<uint32_t>(dense_elements_length); |
| 10178 if (range <= length) { | 10198 if (range <= length) { |
| 10179 length = range; | 10199 length = range; |
| 10180 // We will add all indices, so we might as well clear it first | 10200 // We will add all indices, so we might as well clear it first |
| 10181 // and avoid duplicates. | 10201 // and avoid duplicates. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10278 Handle<Object> element = Object::GetElement(isolate, receiver, index); | 10298 Handle<Object> element = Object::GetElement(isolate, receiver, index); |
| 10279 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, element, false); | 10299 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, element, false); |
| 10280 visitor->visit(index, element); | 10300 visitor->visit(index, element); |
| 10281 // Skip to next different index (i.e., omit duplicates). | 10301 // Skip to next different index (i.e., omit duplicates). |
| 10282 do { | 10302 do { |
| 10283 j++; | 10303 j++; |
| 10284 } while (j < n && indices[j] == index); | 10304 } while (j < n && indices[j] == index); |
| 10285 } | 10305 } |
| 10286 break; | 10306 break; |
| 10287 } | 10307 } |
| 10288 case EXTERNAL_PIXEL_ELEMENTS: { | 10308 case EXTERNAL_UINT8_CLAMPED_ELEMENTS: { |
| 10289 Handle<ExternalPixelArray> pixels(ExternalPixelArray::cast( | 10309 Handle<ExternalUint8ClampedArray> pixels(ExternalUint8ClampedArray::cast( |
| 10290 receiver->elements())); | 10310 receiver->elements())); |
| 10291 for (uint32_t j = 0; j < length; j++) { | 10311 for (uint32_t j = 0; j < length; j++) { |
| 10292 Handle<Smi> e(Smi::FromInt(pixels->get_scalar(j)), isolate); | 10312 Handle<Smi> e(Smi::FromInt(pixels->get_scalar(j)), isolate); |
| 10293 visitor->visit(j, e); | 10313 visitor->visit(j, e); |
| 10294 } | 10314 } |
| 10295 break; | 10315 break; |
| 10296 } | 10316 } |
| 10297 case EXTERNAL_BYTE_ELEMENTS: { | 10317 case EXTERNAL_INT8_ELEMENTS: { |
| 10298 IterateExternalArrayElements<ExternalByteArray, int8_t>( | 10318 IterateExternalArrayElements<ExternalInt8Array, int8_t>( |
| 10299 isolate, receiver, true, true, visitor); | 10319 isolate, receiver, true, true, visitor); |
| 10300 break; | 10320 break; |
| 10301 } | 10321 } |
| 10302 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: { | 10322 case EXTERNAL_UINT8_ELEMENTS: { |
| 10303 IterateExternalArrayElements<ExternalUnsignedByteArray, uint8_t>( | 10323 IterateExternalArrayElements<ExternalUint8Array, uint8_t>( |
| 10304 isolate, receiver, true, true, visitor); | 10324 isolate, receiver, true, true, visitor); |
| 10305 break; | 10325 break; |
| 10306 } | 10326 } |
| 10307 case EXTERNAL_SHORT_ELEMENTS: { | 10327 case EXTERNAL_INT16_ELEMENTS: { |
| 10308 IterateExternalArrayElements<ExternalShortArray, int16_t>( | 10328 IterateExternalArrayElements<ExternalInt16Array, int16_t>( |
| 10309 isolate, receiver, true, true, visitor); | 10329 isolate, receiver, true, true, visitor); |
| 10310 break; | 10330 break; |
| 10311 } | 10331 } |
| 10312 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: { | 10332 case EXTERNAL_UINT16_ELEMENTS: { |
| 10313 IterateExternalArrayElements<ExternalUnsignedShortArray, uint16_t>( | 10333 IterateExternalArrayElements<ExternalUint16Array, uint16_t>( |
| 10314 isolate, receiver, true, true, visitor); | 10334 isolate, receiver, true, true, visitor); |
| 10315 break; | 10335 break; |
| 10316 } | 10336 } |
| 10317 case EXTERNAL_INT_ELEMENTS: { | 10337 case EXTERNAL_INT32_ELEMENTS: { |
| 10318 IterateExternalArrayElements<ExternalIntArray, int32_t>( | 10338 IterateExternalArrayElements<ExternalInt32Array, int32_t>( |
| 10319 isolate, receiver, true, false, visitor); | 10339 isolate, receiver, true, false, visitor); |
| 10320 break; | 10340 break; |
| 10321 } | 10341 } |
| 10322 case EXTERNAL_UNSIGNED_INT_ELEMENTS: { | 10342 case EXTERNAL_UINT32_ELEMENTS: { |
| 10323 IterateExternalArrayElements<ExternalUnsignedIntArray, uint32_t>( | 10343 IterateExternalArrayElements<ExternalUint32Array, uint32_t>( |
| 10324 isolate, receiver, true, false, visitor); | 10344 isolate, receiver, true, false, visitor); |
| 10325 break; | 10345 break; |
| 10326 } | 10346 } |
| 10327 case EXTERNAL_FLOAT_ELEMENTS: { | 10347 case EXTERNAL_FLOAT32_ELEMENTS: { |
| 10328 IterateExternalArrayElements<ExternalFloatArray, float>( | 10348 IterateExternalArrayElements<ExternalFloat32Array, float>( |
| 10329 isolate, receiver, false, false, visitor); | 10349 isolate, receiver, false, false, visitor); |
| 10330 break; | 10350 break; |
| 10331 } | 10351 } |
| 10332 case EXTERNAL_DOUBLE_ELEMENTS: { | 10352 case EXTERNAL_FLOAT64_ELEMENTS: { |
| 10333 IterateExternalArrayElements<ExternalDoubleArray, double>( | 10353 IterateExternalArrayElements<ExternalFloat64Array, double>( |
| 10334 isolate, receiver, false, false, visitor); | 10354 isolate, receiver, false, false, visitor); |
| 10335 break; | 10355 break; |
| 10336 } | 10356 } |
| 10337 default: | 10357 default: |
| 10338 UNREACHABLE(); | 10358 UNREACHABLE(); |
| 10339 break; | 10359 break; |
| 10340 } | 10360 } |
| 10341 visitor->increase_index_offset(length); | 10361 visitor->increase_index_offset(length); |
| 10342 return true; | 10362 return true; |
| 10343 } | 10363 } |
| (...skipping 3696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14040 string_value1.length(), | 14060 string_value1.length(), |
| 14041 u_string2, | 14061 u_string2, |
| 14042 string_value2.length(), | 14062 string_value2.length(), |
| 14043 status); | 14063 status); |
| 14044 if (U_FAILURE(status)) return isolate->ThrowIllegalOperation(); | 14064 if (U_FAILURE(status)) return isolate->ThrowIllegalOperation(); |
| 14045 | 14065 |
| 14046 return *isolate->factory()->NewNumberFromInt(result); | 14066 return *isolate->factory()->NewNumberFromInt(result); |
| 14047 } | 14067 } |
| 14048 | 14068 |
| 14049 | 14069 |
| 14070 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringNormalize) { |
| 14071 HandleScope scope(isolate); |
| 14072 static const UNormalizationMode normalizationForms[] = |
| 14073 { UNORM_NFC, UNORM_NFD, UNORM_NFKC, UNORM_NFKD }; |
| 14074 |
| 14075 ASSERT(args.length() == 2); |
| 14076 |
| 14077 CONVERT_ARG_HANDLE_CHECKED(String, stringValue, 0); |
| 14078 CONVERT_NUMBER_CHECKED(int, form_id, Int32, args[1]); |
| 14079 |
| 14080 v8::String::Value string_value(v8::Utils::ToLocal(stringValue)); |
| 14081 const UChar* u_value = reinterpret_cast<const UChar*>(*string_value); |
| 14082 |
| 14083 // TODO(mnita): check Normalizer2 (not available in ICU 46) |
| 14084 UErrorCode status = U_ZERO_ERROR; |
| 14085 icu::UnicodeString result; |
| 14086 icu::Normalizer::normalize(u_value, normalizationForms[form_id], 0, |
| 14087 result, status); |
| 14088 if (U_FAILURE(status)) { |
| 14089 return isolate->heap()->undefined_value(); |
| 14090 } |
| 14091 |
| 14092 return *isolate->factory()->NewStringFromTwoByte( |
| 14093 Vector<const uint16_t>( |
| 14094 reinterpret_cast<const uint16_t*>(result.getBuffer()), |
| 14095 result.length())); |
| 14096 } |
| 14097 |
| 14098 |
| 14050 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateBreakIterator) { | 14099 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateBreakIterator) { |
| 14051 HandleScope scope(isolate); | 14100 HandleScope scope(isolate); |
| 14052 | 14101 |
| 14053 ASSERT(args.length() == 3); | 14102 ASSERT(args.length() == 3); |
| 14054 | 14103 |
| 14055 CONVERT_ARG_HANDLE_CHECKED(String, locale, 0); | 14104 CONVERT_ARG_HANDLE_CHECKED(String, locale, 0); |
| 14056 CONVERT_ARG_HANDLE_CHECKED(JSObject, options, 1); | 14105 CONVERT_ARG_HANDLE_CHECKED(JSObject, options, 1); |
| 14057 CONVERT_ARG_HANDLE_CHECKED(JSObject, resolved, 2); | 14106 CONVERT_ARG_HANDLE_CHECKED(JSObject, resolved, 2); |
| 14058 | 14107 |
| 14059 Handle<ObjectTemplateInfo> break_iterator_template = | 14108 Handle<ObjectTemplateInfo> break_iterator_template = |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14292 | 14341 |
| 14293 const char* version_string = v8::V8::GetVersion(); | 14342 const char* version_string = v8::V8::GetVersion(); |
| 14294 | 14343 |
| 14295 return isolate->heap()->AllocateStringFromOneByte(CStrVector(version_string), | 14344 return isolate->heap()->AllocateStringFromOneByte(CStrVector(version_string), |
| 14296 NOT_TENURED); | 14345 NOT_TENURED); |
| 14297 } | 14346 } |
| 14298 | 14347 |
| 14299 | 14348 |
| 14300 RUNTIME_FUNCTION(MaybeObject*, Runtime_Abort) { | 14349 RUNTIME_FUNCTION(MaybeObject*, Runtime_Abort) { |
| 14301 SealHandleScope shs(isolate); | 14350 SealHandleScope shs(isolate); |
| 14302 ASSERT(args.length() == 2); | 14351 ASSERT(args.length() == 1); |
| 14303 OS::PrintError("abort: %s\n", | 14352 CONVERT_SMI_ARG_CHECKED(message_id, 0); |
| 14304 reinterpret_cast<char*>(args[0]) + args.smi_at(1)); | 14353 const char* message = GetBailoutReason( |
| 14354 static_cast<BailoutReason>(message_id)); |
| 14355 OS::PrintError("abort: %s\n", message); |
| 14305 isolate->PrintStack(stderr); | 14356 isolate->PrintStack(stderr); |
| 14306 OS::Abort(); | 14357 OS::Abort(); |
| 14307 UNREACHABLE(); | 14358 UNREACHABLE(); |
| 14308 return NULL; | 14359 return NULL; |
| 14309 } | 14360 } |
| 14310 | 14361 |
| 14311 | 14362 |
| 14312 RUNTIME_FUNCTION(MaybeObject*, Runtime_AbortJS) { | 14363 RUNTIME_FUNCTION(MaybeObject*, Runtime_AbortJS) { |
| 14313 HandleScope scope(isolate); | 14364 HandleScope scope(isolate); |
| 14314 ASSERT(args.length() == 1); | 14365 ASSERT(args.length() == 1); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14541 return isolate->heap()->ToBoolean(obj->Has##Name()); \ | 14592 return isolate->heap()->ToBoolean(obj->Has##Name()); \ |
| 14542 } | 14593 } |
| 14543 | 14594 |
| 14544 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiElements) | 14595 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiElements) |
| 14545 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastObjectElements) | 14596 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastObjectElements) |
| 14546 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiOrObjectElements) | 14597 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiOrObjectElements) |
| 14547 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastDoubleElements) | 14598 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastDoubleElements) |
| 14548 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastHoleyElements) | 14599 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastHoleyElements) |
| 14549 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(DictionaryElements) | 14600 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(DictionaryElements) |
| 14550 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(NonStrictArgumentsElements) | 14601 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(NonStrictArgumentsElements) |
| 14551 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalPixelElements) | |
| 14552 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalArrayElements) | 14602 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalArrayElements) |
| 14553 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalByteElements) | |
| 14554 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalUnsignedByteElements) | |
| 14555 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalShortElements) | |
| 14556 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalUnsignedShortElements) | |
| 14557 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalIntElements) | |
| 14558 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalUnsignedIntElements) | |
| 14559 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalFloatElements) | |
| 14560 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalDoubleElements) | |
| 14561 // Properties test sitting with elements tests - not fooling anyone. | 14603 // Properties test sitting with elements tests - not fooling anyone. |
| 14562 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastProperties) | 14604 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastProperties) |
| 14563 | 14605 |
| 14564 #undef ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION | 14606 #undef ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION |
| 14565 | 14607 |
| 14566 | 14608 |
| 14609 #define TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION(Type, type, TYPE, ctype, size) \ |
| 14610 RUNTIME_FUNCTION(MaybeObject*, Runtime_HasExternal##Type##Elements) { \ |
| 14611 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ |
| 14612 return isolate->heap()->ToBoolean(obj->HasExternal##Type##Elements()); \ |
| 14613 } |
| 14614 |
| 14615 TYPED_ARRAYS(TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION) |
| 14616 |
| 14617 #undef TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION |
| 14618 |
| 14619 |
| 14567 RUNTIME_FUNCTION(MaybeObject*, Runtime_HaveSameMap) { | 14620 RUNTIME_FUNCTION(MaybeObject*, Runtime_HaveSameMap) { |
| 14568 SealHandleScope shs(isolate); | 14621 SealHandleScope shs(isolate); |
| 14569 ASSERT(args.length() == 2); | 14622 ASSERT(args.length() == 2); |
| 14570 CONVERT_ARG_CHECKED(JSObject, obj1, 0); | 14623 CONVERT_ARG_CHECKED(JSObject, obj1, 0); |
| 14571 CONVERT_ARG_CHECKED(JSObject, obj2, 1); | 14624 CONVERT_ARG_CHECKED(JSObject, obj2, 1); |
| 14572 return isolate->heap()->ToBoolean(obj1->map() == obj2->map()); | 14625 return isolate->heap()->ToBoolean(obj1->map() == obj2->map()); |
| 14573 } | 14626 } |
| 14574 | 14627 |
| 14575 | 14628 |
| 14576 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsAccessCheckNeeded) { | 14629 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsAccessCheckNeeded) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14621 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetMicrotaskPending) { | 14674 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetMicrotaskPending) { |
| 14622 SealHandleScope shs(isolate); | 14675 SealHandleScope shs(isolate); |
| 14623 ASSERT(args.length() == 1); | 14676 ASSERT(args.length() == 1); |
| 14624 CONVERT_BOOLEAN_ARG_CHECKED(new_state, 0); | 14677 CONVERT_BOOLEAN_ARG_CHECKED(new_state, 0); |
| 14625 bool old_state = isolate->microtask_pending(); | 14678 bool old_state = isolate->microtask_pending(); |
| 14626 isolate->set_microtask_pending(new_state); | 14679 isolate->set_microtask_pending(new_state); |
| 14627 return isolate->heap()->ToBoolean(old_state); | 14680 return isolate->heap()->ToBoolean(old_state); |
| 14628 } | 14681 } |
| 14629 | 14682 |
| 14630 | 14683 |
| 14684 RUNTIME_FUNCTION(MaybeObject*, Runtime_RunMicrotasks) { |
| 14685 HandleScope scope(isolate); |
| 14686 ASSERT(args.length() == 0); |
| 14687 if (isolate->microtask_pending()) |
| 14688 Execution::RunMicrotasks(isolate); |
| 14689 return isolate->heap()->undefined_value(); |
| 14690 } |
| 14691 |
| 14692 |
| 14693 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetMicrotaskState) { |
| 14694 SealHandleScope shs(isolate); |
| 14695 ASSERT(args.length() == 0); |
| 14696 return isolate->heap()->microtask_state(); |
| 14697 } |
| 14698 |
| 14699 |
| 14631 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetObservationState) { | 14700 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetObservationState) { |
| 14632 SealHandleScope shs(isolate); | 14701 SealHandleScope shs(isolate); |
| 14633 ASSERT(args.length() == 0); | 14702 ASSERT(args.length() == 0); |
| 14634 return isolate->heap()->observation_state(); | 14703 return isolate->heap()->observation_state(); |
| 14635 } | 14704 } |
| 14636 | 14705 |
| 14637 | 14706 |
| 14638 RUNTIME_FUNCTION(MaybeObject*, Runtime_ObservationWeakMapCreate) { | 14707 RUNTIME_FUNCTION(MaybeObject*, Runtime_ObservationWeakMapCreate) { |
| 14639 HandleScope scope(isolate); | 14708 HandleScope scope(isolate); |
| 14640 ASSERT(args.length() == 0); | 14709 ASSERT(args.length() == 0); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14772 CONVERT_ARG_HANDLE_CHECKED(Object, type_info, parameters_start + 1); | 14841 CONVERT_ARG_HANDLE_CHECKED(Object, type_info, parameters_start + 1); |
| 14773 #ifdef DEBUG | 14842 #ifdef DEBUG |
| 14774 if (!no_caller_args) { | 14843 if (!no_caller_args) { |
| 14775 CONVERT_SMI_ARG_CHECKED(arg_count, parameters_start + 2); | 14844 CONVERT_SMI_ARG_CHECKED(arg_count, parameters_start + 2); |
| 14776 ASSERT(arg_count == caller_args->length()); | 14845 ASSERT(arg_count == caller_args->length()); |
| 14777 } | 14846 } |
| 14778 #endif | 14847 #endif |
| 14779 | 14848 |
| 14780 Handle<AllocationSite> site; | 14849 Handle<AllocationSite> site; |
| 14781 if (!type_info.is_null() && | 14850 if (!type_info.is_null() && |
| 14782 *type_info != isolate->heap()->undefined_value() && | 14851 *type_info != isolate->heap()->undefined_value()) { |
| 14783 Cell::cast(*type_info)->value()->IsAllocationSite()) { | 14852 site = Handle<AllocationSite>::cast(type_info); |
| 14784 site = Handle<AllocationSite>( | |
| 14785 AllocationSite::cast(Cell::cast(*type_info)->value()), isolate); | |
| 14786 ASSERT(!site->SitePointsToLiteral()); | 14853 ASSERT(!site->SitePointsToLiteral()); |
| 14787 } | 14854 } |
| 14788 | 14855 |
| 14789 return ArrayConstructorCommon(isolate, | 14856 return ArrayConstructorCommon(isolate, |
| 14790 constructor, | 14857 constructor, |
| 14791 site, | 14858 site, |
| 14792 caller_args); | 14859 caller_args); |
| 14793 } | 14860 } |
| 14794 | 14861 |
| 14795 | 14862 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14898 // Handle last resort GC and make sure to allow future allocations | 14965 // Handle last resort GC and make sure to allow future allocations |
| 14899 // to grow the heap without causing GCs (if possible). | 14966 // to grow the heap without causing GCs (if possible). |
| 14900 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14967 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14901 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14968 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14902 "Runtime::PerformGC"); | 14969 "Runtime::PerformGC"); |
| 14903 } | 14970 } |
| 14904 } | 14971 } |
| 14905 | 14972 |
| 14906 | 14973 |
| 14907 } } // namespace v8::internal | 14974 } } // namespace v8::internal |
| OLD | NEW |