Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: src/runtime.cc

Issue 155723005: A64: Synchronize with r19001. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.h ('k') | src/string.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7245 matching lines...) Expand 10 before | Expand all | Expand 10 after
7256 0, separator_length); 7256 0, separator_length);
7257 cursor += separator_length; 7257 cursor += separator_length;
7258 previous_separator_position++; 7258 previous_separator_position++;
7259 } 7259 }
7260 } 7260 }
7261 ASSERT(cursor <= buffer.length()); 7261 ASSERT(cursor <= buffer.length());
7262 } 7262 }
7263 7263
7264 7264
7265 RUNTIME_FUNCTION(MaybeObject*, Runtime_SparseJoinWithSeparator) { 7265 RUNTIME_FUNCTION(MaybeObject*, Runtime_SparseJoinWithSeparator) {
7266 SealHandleScope shs(isolate); 7266 HandleScope scope(isolate);
7267 ASSERT(args.length() == 3); 7267 ASSERT(args.length() == 3);
7268 CONVERT_ARG_CHECKED(JSArray, elements_array, 0); 7268 CONVERT_ARG_CHECKED(JSArray, elements_array, 0);
7269 RUNTIME_ASSERT(elements_array->HasFastSmiOrObjectElements()); 7269 RUNTIME_ASSERT(elements_array->HasFastSmiOrObjectElements());
7270 CONVERT_NUMBER_CHECKED(uint32_t, array_length, Uint32, args[1]); 7270 CONVERT_NUMBER_CHECKED(uint32_t, array_length, Uint32, args[1]);
7271 CONVERT_ARG_CHECKED(String, separator, 2); 7271 CONVERT_ARG_CHECKED(String, separator, 2);
7272 // elements_array is fast-mode JSarray of alternating positions 7272 // elements_array is fast-mode JSarray of alternating positions
7273 // (increasing order) and strings. 7273 // (increasing order) and strings.
7274 // array_length is length of original array (used to add separators); 7274 // array_length is length of original array (used to add separators);
7275 // separator is string to put between elements. Assumed to be non-empty. 7275 // separator is string to put between elements. Assumed to be non-empty.
7276 7276
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
7316 overflow = true; 7316 overflow = true;
7317 } 7317 }
7318 } else { 7318 } else {
7319 // Nonempty separator and at least 2^31-1 separators necessary 7319 // Nonempty separator and at least 2^31-1 separators necessary
7320 // means that the string is too large to create. 7320 // means that the string is too large to create.
7321 STATIC_ASSERT(String::kMaxLength < 0x7fffffff); 7321 STATIC_ASSERT(String::kMaxLength < 0x7fffffff);
7322 overflow = true; 7322 overflow = true;
7323 } 7323 }
7324 } 7324 }
7325 if (overflow) { 7325 if (overflow) {
7326 // Throw OutOfMemory exception for creating too large a string. 7326 // Throw an exception if the resulting string is too large. See
7327 V8::FatalProcessOutOfMemory("Array join result too large."); 7327 // https://code.google.com/p/chromium/issues/detail?id=336820
7328 // for details.
7329 return isolate->Throw(*isolate->factory()->
7330 NewRangeError("invalid_string_length",
7331 HandleVector<Object>(NULL, 0)));
7328 } 7332 }
7329 7333
7330 if (is_ascii) { 7334 if (is_ascii) {
7331 MaybeObject* result_allocation = 7335 MaybeObject* result_allocation =
7332 isolate->heap()->AllocateRawOneByteString(string_length); 7336 isolate->heap()->AllocateRawOneByteString(string_length);
7333 if (result_allocation->IsFailure()) return result_allocation; 7337 if (result_allocation->IsFailure()) return result_allocation;
7334 SeqOneByteString* result_string = 7338 SeqOneByteString* result_string =
7335 SeqOneByteString::cast(result_allocation->ToObjectUnchecked()); 7339 SeqOneByteString::cast(result_allocation->ToObjectUnchecked());
7336 JoinSparseArrayWithSeparator<uint8_t>(elements, 7340 JoinSparseArrayWithSeparator<uint8_t>(elements,
7337 elements_length, 7341 elements_length,
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
8042 int prefix_argc, 8046 int prefix_argc,
8043 int* total_argc) { 8047 int* total_argc) {
8044 // Find frame containing arguments passed to the caller. 8048 // Find frame containing arguments passed to the caller.
8045 JavaScriptFrameIterator it(isolate); 8049 JavaScriptFrameIterator it(isolate);
8046 JavaScriptFrame* frame = it.frame(); 8050 JavaScriptFrame* frame = it.frame();
8047 List<JSFunction*> functions(2); 8051 List<JSFunction*> functions(2);
8048 frame->GetFunctions(&functions); 8052 frame->GetFunctions(&functions);
8049 if (functions.length() > 1) { 8053 if (functions.length() > 1) {
8050 int inlined_jsframe_index = functions.length() - 1; 8054 int inlined_jsframe_index = functions.length() - 1;
8051 JSFunction* inlined_function = functions[inlined_jsframe_index]; 8055 JSFunction* inlined_function = functions[inlined_jsframe_index];
8052 Vector<SlotRef> args_slots = 8056 SlotRefValueBuilder slot_refs(
8053 SlotRef::ComputeSlotMappingForArguments( 8057 frame,
8054 frame, 8058 inlined_jsframe_index,
8055 inlined_jsframe_index, 8059 inlined_function->shared()->formal_parameter_count());
8056 inlined_function->shared()->formal_parameter_count());
8057 8060
8058 int args_count = args_slots.length(); 8061 int args_count = slot_refs.args_length();
8059 8062
8060 *total_argc = prefix_argc + args_count; 8063 *total_argc = prefix_argc + args_count;
8061 SmartArrayPointer<Handle<Object> > param_data( 8064 SmartArrayPointer<Handle<Object> > param_data(
8062 NewArray<Handle<Object> >(*total_argc)); 8065 NewArray<Handle<Object> >(*total_argc));
8066 slot_refs.Prepare(isolate);
8063 for (int i = 0; i < args_count; i++) { 8067 for (int i = 0; i < args_count; i++) {
8064 Handle<Object> val = args_slots[i].GetValue(isolate); 8068 Handle<Object> val = slot_refs.GetNext(isolate, 0);
8065 param_data[prefix_argc + i] = val; 8069 param_data[prefix_argc + i] = val;
8066 } 8070 }
8067 8071 slot_refs.Finish(isolate);
8068 args_slots.Dispose();
8069 8072
8070 return param_data; 8073 return param_data;
8071 } else { 8074 } else {
8072 it.AdvanceToArgumentsFrame(); 8075 it.AdvanceToArgumentsFrame();
8073 frame = it.frame(); 8076 frame = it.frame();
8074 int args_count = frame->ComputeParametersCount(); 8077 int args_count = frame->ComputeParametersCount();
8075 8078
8076 *total_argc = prefix_argc + args_count; 8079 *total_argc = prefix_argc + args_count;
8077 SmartArrayPointer<Handle<Object> > param_data( 8080 SmartArrayPointer<Handle<Object> > param_data(
8078 NewArray<Handle<Object> >(*total_argc)); 8081 NewArray<Handle<Object> >(*total_argc));
(...skipping 5891 matching lines...) Expand 10 before | Expand all | Expand 10 after
13970 string_value1.length(), 13973 string_value1.length(),
13971 u_string2, 13974 u_string2,
13972 string_value2.length(), 13975 string_value2.length(),
13973 status); 13976 status);
13974 if (U_FAILURE(status)) return isolate->ThrowIllegalOperation(); 13977 if (U_FAILURE(status)) return isolate->ThrowIllegalOperation();
13975 13978
13976 return *isolate->factory()->NewNumberFromInt(result); 13979 return *isolate->factory()->NewNumberFromInt(result);
13977 } 13980 }
13978 13981
13979 13982
13983 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringNormalize) {
13984 HandleScope scope(isolate);
13985 static const UNormalizationMode normalizationForms[] =
13986 { UNORM_NFC, UNORM_NFD, UNORM_NFKC, UNORM_NFKD };
13987
13988 ASSERT(args.length() == 2);
13989
13990 CONVERT_ARG_HANDLE_CHECKED(String, stringValue, 0);
13991 CONVERT_NUMBER_CHECKED(int, form_id, Int32, args[1]);
13992
13993 v8::String::Value string_value(v8::Utils::ToLocal(stringValue));
13994 const UChar* u_value = reinterpret_cast<const UChar*>(*string_value);
13995
13996 // TODO(mnita): check Normalizer2 (not available in ICU 46)
13997 UErrorCode status = U_ZERO_ERROR;
13998 icu::UnicodeString result;
13999 icu::Normalizer::normalize(u_value, normalizationForms[form_id], 0,
14000 result, status);
14001 if (U_FAILURE(status)) {
14002 return isolate->heap()->undefined_value();
14003 }
14004
14005 return *isolate->factory()->NewStringFromTwoByte(
14006 Vector<const uint16_t>(
14007 reinterpret_cast<const uint16_t*>(result.getBuffer()),
14008 result.length()));
14009 }
14010
14011
13980 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateBreakIterator) { 14012 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateBreakIterator) {
13981 HandleScope scope(isolate); 14013 HandleScope scope(isolate);
13982 14014
13983 ASSERT(args.length() == 3); 14015 ASSERT(args.length() == 3);
13984 14016
13985 CONVERT_ARG_HANDLE_CHECKED(String, locale, 0); 14017 CONVERT_ARG_HANDLE_CHECKED(String, locale, 0);
13986 CONVERT_ARG_HANDLE_CHECKED(JSObject, options, 1); 14018 CONVERT_ARG_HANDLE_CHECKED(JSObject, options, 1);
13987 CONVERT_ARG_HANDLE_CHECKED(JSObject, resolved, 2); 14019 CONVERT_ARG_HANDLE_CHECKED(JSObject, resolved, 2);
13988 14020
13989 Handle<ObjectTemplateInfo> break_iterator_template = 14021 Handle<ObjectTemplateInfo> break_iterator_template =
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
14828 // Handle last resort GC and make sure to allow future allocations 14860 // Handle last resort GC and make sure to allow future allocations
14829 // to grow the heap without causing GCs (if possible). 14861 // to grow the heap without causing GCs (if possible).
14830 isolate->counters()->gc_last_resort_from_js()->Increment(); 14862 isolate->counters()->gc_last_resort_from_js()->Increment();
14831 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14863 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14832 "Runtime::PerformGC"); 14864 "Runtime::PerformGC");
14833 } 14865 }
14834 } 14866 }
14835 14867
14836 14868
14837 } } // namespace v8::internal 14869 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | src/string.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698