| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 3373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3384 static Object* Runtime_StringToLowerCase(Arguments args) { | 3384 static Object* Runtime_StringToLowerCase(Arguments args) { |
| 3385 return ConvertCase<unibrow::ToLowercase>(args, &to_lower_mapping); | 3385 return ConvertCase<unibrow::ToLowercase>(args, &to_lower_mapping); |
| 3386 } | 3386 } |
| 3387 | 3387 |
| 3388 | 3388 |
| 3389 static Object* Runtime_StringToUpperCase(Arguments args) { | 3389 static Object* Runtime_StringToUpperCase(Arguments args) { |
| 3390 return ConvertCase<unibrow::ToUppercase>(args, &to_upper_mapping); | 3390 return ConvertCase<unibrow::ToUppercase>(args, &to_upper_mapping); |
| 3391 } | 3391 } |
| 3392 | 3392 |
| 3393 | 3393 |
| 3394 bool Runtime::IsUpperCaseChar(uint16_t ch) { |
| 3395 unibrow::uchar chars[unibrow::ToUppercase::kMaxWidth]; |
| 3396 int char_length = to_upper_mapping.get(ch, 0, chars); |
| 3397 return char_length == 0; |
| 3398 } |
| 3399 |
| 3400 |
| 3394 static Object* Runtime_NumberToString(Arguments args) { | 3401 static Object* Runtime_NumberToString(Arguments args) { |
| 3395 NoHandleAllocation ha; | 3402 NoHandleAllocation ha; |
| 3396 ASSERT(args.length() == 1); | 3403 ASSERT(args.length() == 1); |
| 3397 | 3404 |
| 3398 Object* number = args[0]; | 3405 Object* number = args[0]; |
| 3399 RUNTIME_ASSERT(number->IsNumber()); | 3406 RUNTIME_ASSERT(number->IsNumber()); |
| 3400 | 3407 |
| 3401 Object* cached = Heap::GetNumberStringCache(number); | 3408 Object* cached = Heap::GetNumberStringCache(number); |
| 3402 if (cached != Heap::undefined_value()) { | 3409 if (cached != Heap::undefined_value()) { |
| 3403 return cached; | 3410 return cached; |
| (...skipping 2650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6054 RUNTIME_ASSERT(source_position >= 0); | 6061 RUNTIME_ASSERT(source_position >= 0); |
| 6055 Handle<Object> break_point_object_arg = args.at<Object>(2); | 6062 Handle<Object> break_point_object_arg = args.at<Object>(2); |
| 6056 | 6063 |
| 6057 // Set break point. | 6064 // Set break point. |
| 6058 Debug::SetBreakPoint(shared, source_position, break_point_object_arg); | 6065 Debug::SetBreakPoint(shared, source_position, break_point_object_arg); |
| 6059 | 6066 |
| 6060 return Heap::undefined_value(); | 6067 return Heap::undefined_value(); |
| 6061 } | 6068 } |
| 6062 | 6069 |
| 6063 | 6070 |
| 6064 static Object* FindSharedFunctionInfoInScript(Handle<Script> script, | 6071 Object* Runtime::FindSharedFunctionInfoInScript(Handle<Script> script, |
| 6065 int position) { | 6072 int position) { |
| 6066 // Iterate the heap looking for SharedFunctionInfo generated from the | 6073 // Iterate the heap looking for SharedFunctionInfo generated from the |
| 6067 // script. The inner most SharedFunctionInfo containing the source position | 6074 // script. The inner most SharedFunctionInfo containing the source position |
| 6068 // for the requested break point is found. | 6075 // for the requested break point is found. |
| 6069 // NOTE: This might reqire several heap iterations. If the SharedFunctionInfo | 6076 // NOTE: This might reqire several heap iterations. If the SharedFunctionInfo |
| 6070 // which is found is not compiled it is compiled and the heap is iterated | 6077 // which is found is not compiled it is compiled and the heap is iterated |
| 6071 // again as the compilation might create inner functions from the newly | 6078 // again as the compilation might create inner functions from the newly |
| 6072 // compiled function and the actual requested break point might be in one of | 6079 // compiled function and the actual requested break point might be in one of |
| 6073 // these functions. | 6080 // these functions. |
| 6074 bool done = false; | 6081 bool done = false; |
| 6075 // The current candidate for the source position: | 6082 // The current candidate for the source position: |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6152 ASSERT(args.length() == 3); | 6159 ASSERT(args.length() == 3); |
| 6153 CONVERT_ARG_CHECKED(JSValue, wrapper, 0); | 6160 CONVERT_ARG_CHECKED(JSValue, wrapper, 0); |
| 6154 CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); | 6161 CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); |
| 6155 RUNTIME_ASSERT(source_position >= 0); | 6162 RUNTIME_ASSERT(source_position >= 0); |
| 6156 Handle<Object> break_point_object_arg = args.at<Object>(2); | 6163 Handle<Object> break_point_object_arg = args.at<Object>(2); |
| 6157 | 6164 |
| 6158 // Get the script from the script wrapper. | 6165 // Get the script from the script wrapper. |
| 6159 RUNTIME_ASSERT(wrapper->value()->IsScript()); | 6166 RUNTIME_ASSERT(wrapper->value()->IsScript()); |
| 6160 Handle<Script> script(Script::cast(wrapper->value())); | 6167 Handle<Script> script(Script::cast(wrapper->value())); |
| 6161 | 6168 |
| 6162 Object* result = FindSharedFunctionInfoInScript(script, source_position); | 6169 Object* result = Runtime::FindSharedFunctionInfoInScript( |
| 6170 script, source_position); |
| 6163 if (!result->IsUndefined()) { | 6171 if (!result->IsUndefined()) { |
| 6164 Handle<SharedFunctionInfo> shared(SharedFunctionInfo::cast(result)); | 6172 Handle<SharedFunctionInfo> shared(SharedFunctionInfo::cast(result)); |
| 6165 // Find position within function. The script position might be before the | 6173 // Find position within function. The script position might be before the |
| 6166 // source position of the first function. | 6174 // source position of the first function. |
| 6167 int position; | 6175 int position; |
| 6168 if (shared->start_position() > source_position) { | 6176 if (shared->start_position() > source_position) { |
| 6169 position = 0; | 6177 position = 0; |
| 6170 } else { | 6178 } else { |
| 6171 position = source_position - shared->start_position(); | 6179 position = source_position - shared->start_position(); |
| 6172 } | 6180 } |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6944 } else { | 6952 } else { |
| 6945 // Handle last resort GC and make sure to allow future allocations | 6953 // Handle last resort GC and make sure to allow future allocations |
| 6946 // to grow the heap without causing GCs (if possible). | 6954 // to grow the heap without causing GCs (if possible). |
| 6947 Counters::gc_last_resort_from_js.Increment(); | 6955 Counters::gc_last_resort_from_js.Increment(); |
| 6948 Heap::CollectAllGarbage(); | 6956 Heap::CollectAllGarbage(); |
| 6949 } | 6957 } |
| 6950 } | 6958 } |
| 6951 | 6959 |
| 6952 | 6960 |
| 6953 } } // namespace v8::internal | 6961 } } // namespace v8::internal |
| OLD | NEW |