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

Side by Side Diff: src/runtime.cc

Issue 6903060: Version 3.3.2.... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 9 years, 8 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/regexp-macro-assembler-irregexp-inl.h ('k') | src/runtime-profiler.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2695 matching lines...) Expand 10 before | Expand all | Expand 10 after
2706 int start, end; 2706 int start, end;
2707 { 2707 {
2708 AssertNoAllocation match_info_array_is_not_in_a_handle; 2708 AssertNoAllocation match_info_array_is_not_in_a_handle;
2709 FixedArray* match_info_array = 2709 FixedArray* match_info_array =
2710 FixedArray::cast(last_match_info_handle->elements()); 2710 FixedArray::cast(last_match_info_handle->elements());
2711 2711
2712 start = RegExpImpl::GetCapture(match_info_array, 0); 2712 start = RegExpImpl::GetCapture(match_info_array, 0);
2713 end = RegExpImpl::GetCapture(match_info_array, 1); 2713 end = RegExpImpl::GetCapture(match_info_array, 1);
2714 } 2714 }
2715 2715
2716 int length = subject->length(); 2716 int length = subject_handle->length();
2717 int new_length = length - (end - start); 2717 int new_length = length - (end - start);
2718 if (new_length == 0) { 2718 if (new_length == 0) {
2719 return isolate->heap()->empty_string(); 2719 return isolate->heap()->empty_string();
2720 } 2720 }
2721 Handle<ResultSeqString> answer; 2721 Handle<ResultSeqString> answer;
2722 if (ResultSeqString::kHasAsciiEncoding) { 2722 if (ResultSeqString::kHasAsciiEncoding) {
2723 answer = Handle<ResultSeqString>::cast( 2723 answer = Handle<ResultSeqString>::cast(
2724 isolate->factory()->NewRawAsciiString(new_length)); 2724 isolate->factory()->NewRawAsciiString(new_length));
2725 } else { 2725 } else {
2726 answer = Handle<ResultSeqString>::cast( 2726 answer = Handle<ResultSeqString>::cast(
(...skipping 4564 matching lines...) Expand 10 before | Expand all | Expand 10 after
7291 } 7291 }
7292 7292
7293 7293
7294 RUNTIME_FUNCTION(MaybeObject*, Runtime_LazyRecompile) { 7294 RUNTIME_FUNCTION(MaybeObject*, Runtime_LazyRecompile) {
7295 HandleScope scope(isolate); 7295 HandleScope scope(isolate);
7296 ASSERT(args.length() == 1); 7296 ASSERT(args.length() == 1);
7297 Handle<JSFunction> function = args.at<JSFunction>(0); 7297 Handle<JSFunction> function = args.at<JSFunction>(0);
7298 // If the function is not optimizable or debugger is active continue using the 7298 // If the function is not optimizable or debugger is active continue using the
7299 // code from the full compiler. 7299 // code from the full compiler.
7300 if (!function->shared()->code()->optimizable() || 7300 if (!function->shared()->code()->optimizable() ||
7301 isolate->debug()->has_break_points()) { 7301 isolate->DebuggerHasBreakPoints()) {
7302 if (FLAG_trace_opt) { 7302 if (FLAG_trace_opt) {
7303 PrintF("[failed to optimize "); 7303 PrintF("[failed to optimize ");
7304 function->PrintName(); 7304 function->PrintName();
7305 PrintF(": is code optimizable: %s, is debugger enabled: %s]\n", 7305 PrintF(": is code optimizable: %s, is debugger enabled: %s]\n",
7306 function->shared()->code()->optimizable() ? "T" : "F", 7306 function->shared()->code()->optimizable() ? "T" : "F",
7307 isolate->debug()->has_break_points() ? "T" : "F"); 7307 isolate->DebuggerHasBreakPoints() ? "T" : "F");
7308 } 7308 }
7309 function->ReplaceCode(function->shared()->code()); 7309 function->ReplaceCode(function->shared()->code());
7310 return function->code(); 7310 return function->code();
7311 } 7311 }
7312 if (CompileOptimized(function, AstNode::kNoNumber, CLEAR_EXCEPTION)) { 7312 if (CompileOptimized(function, AstNode::kNoNumber, CLEAR_EXCEPTION)) {
7313 return function->code(); 7313 return function->code();
7314 } 7314 }
7315 if (FLAG_trace_opt) { 7315 if (FLAG_trace_opt) {
7316 PrintF("[failed to optimize "); 7316 PrintF("[failed to optimize ");
7317 function->PrintName(); 7317 function->PrintName();
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
8596 indices->Add(index); 8596 indices->Add(index);
8597 } 8597 }
8598 } 8598 }
8599 } 8599 }
8600 break; 8600 break;
8601 } 8601 }
8602 default: { 8602 default: {
8603 int dense_elements_length; 8603 int dense_elements_length;
8604 switch (kind) { 8604 switch (kind) {
8605 case JSObject::EXTERNAL_PIXEL_ELEMENTS: { 8605 case JSObject::EXTERNAL_PIXEL_ELEMENTS: {
8606 dense_elements_length = 8606 dense_elements_length =
8607 ExternalPixelArray::cast(object->elements())->length(); 8607 ExternalPixelArray::cast(object->elements())->length();
8608 break; 8608 break;
8609 } 8609 }
8610 case JSObject::EXTERNAL_BYTE_ELEMENTS: { 8610 case JSObject::EXTERNAL_BYTE_ELEMENTS: {
8611 dense_elements_length = 8611 dense_elements_length =
8612 ExternalByteArray::cast(object->elements())->length(); 8612 ExternalByteArray::cast(object->elements())->length();
8613 break; 8613 break;
8614 } 8614 }
8615 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: { 8615 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: {
8616 dense_elements_length = 8616 dense_elements_length =
8617 ExternalUnsignedByteArray::cast(object->elements())->length(); 8617 ExternalUnsignedByteArray::cast(object->elements())->length();
8618 break; 8618 break;
8619 } 8619 }
8620 case JSObject::EXTERNAL_SHORT_ELEMENTS: { 8620 case JSObject::EXTERNAL_SHORT_ELEMENTS: {
8621 dense_elements_length = 8621 dense_elements_length =
8622 ExternalShortArray::cast(object->elements())->length(); 8622 ExternalShortArray::cast(object->elements())->length();
8623 break; 8623 break;
8624 } 8624 }
8625 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS: { 8625 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS: {
8626 dense_elements_length = 8626 dense_elements_length =
8627 ExternalUnsignedShortArray::cast(object->elements())->length(); 8627 ExternalUnsignedShortArray::cast(object->elements())->length();
8628 break; 8628 break;
8629 } 8629 }
8630 case JSObject::EXTERNAL_INT_ELEMENTS: { 8630 case JSObject::EXTERNAL_INT_ELEMENTS: {
8631 dense_elements_length = 8631 dense_elements_length =
8632 ExternalIntArray::cast(object->elements())->length(); 8632 ExternalIntArray::cast(object->elements())->length();
8633 break; 8633 break;
8634 } 8634 }
8635 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: { 8635 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: {
8636 dense_elements_length = 8636 dense_elements_length =
8637 ExternalUnsignedIntArray::cast(object->elements())->length(); 8637 ExternalUnsignedIntArray::cast(object->elements())->length();
8638 break; 8638 break;
8639 } 8639 }
8640 case JSObject::EXTERNAL_FLOAT_ELEMENTS: { 8640 case JSObject::EXTERNAL_FLOAT_ELEMENTS: {
8641 dense_elements_length = 8641 dense_elements_length =
8642 ExternalFloatArray::cast(object->elements())->length(); 8642 ExternalFloatArray::cast(object->elements())->length();
8643 break;
8644 }
8645 case JSObject::EXTERNAL_DOUBLE_ELEMENTS: {
8646 dense_elements_length =
8647 ExternalDoubleArray::cast(object->elements())->length();
8643 break; 8648 break;
8644 } 8649 }
8645 default: 8650 default:
8646 UNREACHABLE(); 8651 UNREACHABLE();
8647 dense_elements_length = 0; 8652 dense_elements_length = 0;
8648 break; 8653 break;
8649 } 8654 }
8650 uint32_t length = static_cast<uint32_t>(dense_elements_length); 8655 uint32_t length = static_cast<uint32_t>(dense_elements_length);
8651 if (range <= length) { 8656 if (range <= length) {
8652 length = range; 8657 length = range;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
8766 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: { 8771 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: {
8767 IterateExternalArrayElements<ExternalUnsignedIntArray, uint32_t>( 8772 IterateExternalArrayElements<ExternalUnsignedIntArray, uint32_t>(
8768 isolate, receiver, true, false, visitor); 8773 isolate, receiver, true, false, visitor);
8769 break; 8774 break;
8770 } 8775 }
8771 case JSObject::EXTERNAL_FLOAT_ELEMENTS: { 8776 case JSObject::EXTERNAL_FLOAT_ELEMENTS: {
8772 IterateExternalArrayElements<ExternalFloatArray, float>( 8777 IterateExternalArrayElements<ExternalFloatArray, float>(
8773 isolate, receiver, false, false, visitor); 8778 isolate, receiver, false, false, visitor);
8774 break; 8779 break;
8775 } 8780 }
8781 case JSObject::EXTERNAL_DOUBLE_ELEMENTS: {
8782 IterateExternalArrayElements<ExternalDoubleArray, double>(
8783 isolate, receiver, false, false, visitor);
8784 break;
8785 }
8776 default: 8786 default:
8777 UNREACHABLE(); 8787 UNREACHABLE();
8778 break; 8788 break;
8779 } 8789 }
8780 visitor->increase_index_offset(length); 8790 visitor->increase_index_offset(length);
8781 return true; 8791 return true;
8782 } 8792 }
8783 8793
8784 8794
8785 /** 8795 /**
(...skipping 3189 matching lines...) Expand 10 before | Expand all | Expand 10 after
11975 } else { 11985 } else {
11976 // Handle last resort GC and make sure to allow future allocations 11986 // Handle last resort GC and make sure to allow future allocations
11977 // to grow the heap without causing GCs (if possible). 11987 // to grow the heap without causing GCs (if possible).
11978 isolate->counters()->gc_last_resort_from_js()->Increment(); 11988 isolate->counters()->gc_last_resort_from_js()->Increment();
11979 isolate->heap()->CollectAllGarbage(false); 11989 isolate->heap()->CollectAllGarbage(false);
11980 } 11990 }
11981 } 11991 }
11982 11992
11983 11993
11984 } } // namespace v8::internal 11994 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/regexp-macro-assembler-irregexp-inl.h ('k') | src/runtime-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698