| OLD | NEW |
| 1 // Copyright 2008-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2008-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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 * - esi : end of input (points to byte after last character in input). | 49 * - esi : end of input (points to byte after last character in input). |
| 50 * - ebp : frame pointer. Used to access arguments, local variables and | 50 * - ebp : frame pointer. Used to access arguments, local variables and |
| 51 * RegExp registers. | 51 * RegExp registers. |
| 52 * - esp : points to tip of C stack. | 52 * - esp : points to tip of C stack. |
| 53 * - ecx : points to tip of backtrack stack | 53 * - ecx : points to tip of backtrack stack |
| 54 * | 54 * |
| 55 * The registers eax and ebx are free to use for computations. | 55 * The registers eax and ebx are free to use for computations. |
| 56 * | 56 * |
| 57 * Each call to a public method should retain this convention. | 57 * Each call to a public method should retain this convention. |
| 58 * The stack will have the following structure: | 58 * The stack will have the following structure: |
| 59 * - Isolate* isolate (Address of the current isolate) |
| 59 * - direct_call (if 1, direct call from JavaScript code, if 0 | 60 * - direct_call (if 1, direct call from JavaScript code, if 0 |
| 60 * call through the runtime system) | 61 * call through the runtime system) |
| 61 * - stack_area_base (High end of the memory area to use as | 62 * - stack_area_base (High end of the memory area to use as |
| 62 * backtracking stack) | 63 * backtracking stack) |
| 63 * - int* capture_array (int[num_saved_registers_], for output). | 64 * - int* capture_array (int[num_saved_registers_], for output). |
| 64 * - end of input (Address of end of string) | 65 * - end of input (Address of end of string) |
| 65 * - start of input (Address of first character in string) | 66 * - start of input (Address of first character in string) |
| 66 * - start index (character index of start) | 67 * - start index (character index of start) |
| 67 * - String* input_string (location of a handle containing the string) | 68 * - String* input_string (location of a handle containing the string) |
| 68 * --- frame alignment (if applicable) --- | 69 * --- frame alignment (if applicable) --- |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 if (exit_with_exception.is_linked()) { | 860 if (exit_with_exception.is_linked()) { |
| 860 // If any of the code above needed to exit with an exception. | 861 // If any of the code above needed to exit with an exception. |
| 861 __ bind(&exit_with_exception); | 862 __ bind(&exit_with_exception); |
| 862 // Exit with Result EXCEPTION(-1) to signal thrown exception. | 863 // Exit with Result EXCEPTION(-1) to signal thrown exception. |
| 863 __ mov(eax, EXCEPTION); | 864 __ mov(eax, EXCEPTION); |
| 864 __ jmp(&exit_label_); | 865 __ jmp(&exit_label_); |
| 865 } | 866 } |
| 866 | 867 |
| 867 CodeDesc code_desc; | 868 CodeDesc code_desc; |
| 868 masm_->GetCode(&code_desc); | 869 masm_->GetCode(&code_desc); |
| 869 Handle<Code> code = Factory::NewCode(code_desc, | 870 Isolate* isolate = ISOLATE; |
| 870 Code::ComputeFlags(Code::REGEXP), | 871 Handle<Code> code = |
| 871 masm_->CodeObject()); | 872 isolate->factory()->NewCode(code_desc, |
| 872 PROFILE(RegExpCodeCreateEvent(*code, *source)); | 873 Code::ComputeFlags(Code::REGEXP), |
| 874 masm_->CodeObject()); |
| 875 PROFILE(isolate, RegExpCodeCreateEvent(*code, *source)); |
| 873 return Handle<Object>::cast(code); | 876 return Handle<Object>::cast(code); |
| 874 } | 877 } |
| 875 | 878 |
| 876 | 879 |
| 877 void RegExpMacroAssemblerIA32::GoTo(Label* to) { | 880 void RegExpMacroAssemblerIA32::GoTo(Label* to) { |
| 878 BranchOrBacktrack(no_condition, to); | 881 BranchOrBacktrack(no_condition, to); |
| 879 } | 882 } |
| 880 | 883 |
| 881 | 884 |
| 882 void RegExpMacroAssemblerIA32::IfRegisterGE(int reg, | 885 void RegExpMacroAssemblerIA32::IfRegisterGE(int reg, |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 // Helper function for reading a value out of a stack frame. | 1035 // Helper function for reading a value out of a stack frame. |
| 1033 template <typename T> | 1036 template <typename T> |
| 1034 static T& frame_entry(Address re_frame, int frame_offset) { | 1037 static T& frame_entry(Address re_frame, int frame_offset) { |
| 1035 return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset)); | 1038 return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset)); |
| 1036 } | 1039 } |
| 1037 | 1040 |
| 1038 | 1041 |
| 1039 int RegExpMacroAssemblerIA32::CheckStackGuardState(Address* return_address, | 1042 int RegExpMacroAssemblerIA32::CheckStackGuardState(Address* return_address, |
| 1040 Code* re_code, | 1043 Code* re_code, |
| 1041 Address re_frame) { | 1044 Address re_frame) { |
| 1042 if (StackGuard::IsStackOverflow()) { | 1045 Isolate* isolate = frame_entry<Isolate*>(re_frame, kIsolate); |
| 1043 Top::StackOverflow(); | 1046 ASSERT(isolate == Isolate::Current()); |
| 1047 if (isolate->stack_guard()->IsStackOverflow()) { |
| 1048 isolate->StackOverflow(); |
| 1044 return EXCEPTION; | 1049 return EXCEPTION; |
| 1045 } | 1050 } |
| 1046 | 1051 |
| 1047 // If not real stack overflow the stack guard was used to interrupt | 1052 // If not real stack overflow the stack guard was used to interrupt |
| 1048 // execution for another purpose. | 1053 // execution for another purpose. |
| 1049 | 1054 |
| 1050 // If this is a direct call from JavaScript retry the RegExp forcing the call | 1055 // If this is a direct call from JavaScript retry the RegExp forcing the call |
| 1051 // through the runtime system. Currently the direct call cannot handle a GC. | 1056 // through the runtime system. Currently the direct call cannot handle a GC. |
| 1052 if (frame_entry<int>(re_frame, kDirectCall) == 1) { | 1057 if (frame_entry<int>(re_frame, kDirectCall) == 1) { |
| 1053 return RETRY; | 1058 return RETRY; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 } | 1249 } |
| 1245 | 1250 |
| 1246 | 1251 |
| 1247 #undef __ | 1252 #undef __ |
| 1248 | 1253 |
| 1249 #endif // V8_INTERPRETED_REGEXP | 1254 #endif // V8_INTERPRETED_REGEXP |
| 1250 | 1255 |
| 1251 }} // namespace v8::internal | 1256 }} // namespace v8::internal |
| 1252 | 1257 |
| 1253 #endif // V8_TARGET_ARCH_IA32 | 1258 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |