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

Side by Side Diff: src/runtime.cc

Issue 149403003: A64: Synchronize with r19234. (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/preparser.cc ('k') | src/scanner.h » ('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 6523 matching lines...) Expand 10 before | Expand all | Expand 10 after
6534 args, isolate, isolate->runtime_state()->to_lower_mapping()); 6534 args, isolate, isolate->runtime_state()->to_lower_mapping());
6535 } 6535 }
6536 6536
6537 6537
6538 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringToUpperCase) { 6538 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringToUpperCase) {
6539 return ConvertCase( 6539 return ConvertCase(
6540 args, isolate, isolate->runtime_state()->to_upper_mapping()); 6540 args, isolate, isolate->runtime_state()->to_upper_mapping());
6541 } 6541 }
6542 6542
6543 6543
6544 static inline bool IsTrimWhiteSpace(unibrow::uchar c) {
6545 return unibrow::WhiteSpace::Is(c) || c == 0x200b || c == 0xfeff;
6546 }
6547
6548
6549 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringTrim) { 6544 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringTrim) {
6550 HandleScope scope(isolate); 6545 HandleScope scope(isolate);
6551 ASSERT(args.length() == 3); 6546 ASSERT(args.length() == 3);
6552 6547
6553 CONVERT_ARG_HANDLE_CHECKED(String, string, 0); 6548 CONVERT_ARG_HANDLE_CHECKED(String, string, 0);
6554 CONVERT_BOOLEAN_ARG_CHECKED(trimLeft, 1); 6549 CONVERT_BOOLEAN_ARG_CHECKED(trimLeft, 1);
6555 CONVERT_BOOLEAN_ARG_CHECKED(trimRight, 2); 6550 CONVERT_BOOLEAN_ARG_CHECKED(trimRight, 2);
6556 6551
6557 string = FlattenGetString(string); 6552 string = FlattenGetString(string);
6558 int length = string->length(); 6553 int length = string->length();
6559 6554
6560 int left = 0; 6555 int left = 0;
6556 UnicodeCache* unicode_cache = isolate->unicode_cache();
6561 if (trimLeft) { 6557 if (trimLeft) {
6562 while (left < length && IsTrimWhiteSpace(string->Get(left))) { 6558 while (left < length &&
6559 unicode_cache->IsWhiteSpaceOrLineTerminator(string->Get(left))) {
6563 left++; 6560 left++;
6564 } 6561 }
6565 } 6562 }
6566 6563
6567 int right = length; 6564 int right = length;
6568 if (trimRight) { 6565 if (trimRight) {
6569 while (right > left && IsTrimWhiteSpace(string->Get(right - 1))) { 6566 while (right > left &&
6567 unicode_cache->IsWhiteSpaceOrLineTerminator(
6568 string->Get(right - 1))) {
6570 right--; 6569 right--;
6571 } 6570 }
6572 } 6571 }
6573 6572
6574 return *isolate->factory()->NewSubString(string, left, right); 6573 return *isolate->factory()->NewSubString(string, left, right);
6575 } 6574 }
6576 6575
6577 6576
6578 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringSplit) { 6577 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringSplit) {
6579 HandleScope handle_scope(isolate); 6578 HandleScope handle_scope(isolate);
(...skipping 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after
8496 return isolate->concurrent_recompilation_enabled() 8495 return isolate->concurrent_recompilation_enabled()
8497 ? isolate->heap()->true_value() : isolate->heap()->false_value(); 8496 ? isolate->heap()->true_value() : isolate->heap()->false_value();
8498 } 8497 }
8499 8498
8500 8499
8501 RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) { 8500 RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) {
8502 HandleScope scope(isolate); 8501 HandleScope scope(isolate);
8503 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); 8502 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2);
8504 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 8503 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
8505 8504
8506 if (!function->IsOptimizable()) return isolate->heap()->undefined_value(); 8505 if (!function->IsOptimizable() &&
8506 !function->IsMarkedForConcurrentOptimization() &&
8507 !function->IsInOptimizationQueue()) {
8508 return isolate->heap()->undefined_value();
8509 }
8510
8507 function->MarkForOptimization(); 8511 function->MarkForOptimization();
8508 8512
8509 Code* unoptimized = function->shared()->code(); 8513 Code* unoptimized = function->shared()->code();
8510 if (args.length() == 2 && 8514 if (args.length() == 2 &&
8511 unoptimized->kind() == Code::FUNCTION) { 8515 unoptimized->kind() == Code::FUNCTION) {
8512 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); 8516 CONVERT_ARG_HANDLE_CHECKED(String, type, 1);
8513 if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("osr"))) { 8517 if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("osr"))) {
8514 // Start patching from the currently patched loop nesting level. 8518 // Start patching from the currently patched loop nesting level.
8515 int current_level = unoptimized->allow_osr_at_loop_nesting_level(); 8519 int current_level = unoptimized->allow_osr_at_loop_nesting_level();
8516 ASSERT(BackEdgeTable::Verify(isolate, unoptimized, current_level)); 8520 ASSERT(BackEdgeTable::Verify(isolate, unoptimized, current_level));
(...skipping 6343 matching lines...) Expand 10 before | Expand all | Expand 10 after
14860 // Handle last resort GC and make sure to allow future allocations 14864 // Handle last resort GC and make sure to allow future allocations
14861 // to grow the heap without causing GCs (if possible). 14865 // to grow the heap without causing GCs (if possible).
14862 isolate->counters()->gc_last_resort_from_js()->Increment(); 14866 isolate->counters()->gc_last_resort_from_js()->Increment();
14863 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14867 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14864 "Runtime::PerformGC"); 14868 "Runtime::PerformGC");
14865 } 14869 }
14866 } 14870 }
14867 14871
14868 14872
14869 } } // namespace v8::internal 14873 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/preparser.cc ('k') | src/scanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698