| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 137 |
| 138 bool is_json = (validate == Compiler::VALIDATE_JSON); | 138 bool is_json = (validate == Compiler::VALIDATE_JSON); |
| 139 #ifdef ENABLE_DEBUGGER_SUPPORT | 139 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 140 if (is_eval || is_json) { | 140 if (is_eval || is_json) { |
| 141 script->set_compilation_type( | 141 script->set_compilation_type( |
| 142 is_json ? Smi::FromInt(Script::COMPILATION_TYPE_JSON) : | 142 is_json ? Smi::FromInt(Script::COMPILATION_TYPE_JSON) : |
| 143 Smi::FromInt(Script::COMPILATION_TYPE_EVAL)); | 143 Smi::FromInt(Script::COMPILATION_TYPE_EVAL)); |
| 144 // For eval scripts add information on the function from which eval was | 144 // For eval scripts add information on the function from which eval was |
| 145 // called. | 145 // called. |
| 146 if (is_eval) { | 146 if (is_eval) { |
| 147 JavaScriptFrameIterator it; | 147 StackTraceFrameIterator it; |
| 148 script->set_eval_from_shared( | 148 if (!it.done()) { |
| 149 JSFunction::cast(it.frame()->function())->shared()); | 149 script->set_eval_from_shared( |
| 150 int offset = static_cast<int>( | 150 JSFunction::cast(it.frame()->function())->shared()); |
| 151 it.frame()->pc() - it.frame()->code()->instruction_start()); | 151 int offset = static_cast<int>( |
| 152 script->set_eval_from_instructions_offset(Smi::FromInt(offset)); | 152 it.frame()->pc() - it.frame()->code()->instruction_start()); |
| 153 script->set_eval_from_instructions_offset(Smi::FromInt(offset)); |
| 154 } |
| 153 } | 155 } |
| 154 } | 156 } |
| 155 | 157 |
| 156 // Notify debugger | 158 // Notify debugger |
| 157 Debugger::OnBeforeCompile(script); | 159 Debugger::OnBeforeCompile(script); |
| 158 #endif | 160 #endif |
| 159 | 161 |
| 160 // Only allow non-global compiles for eval. | 162 // Only allow non-global compiles for eval. |
| 161 ASSERT(is_eval || is_global); | 163 ASSERT(is_eval || is_global); |
| 162 | 164 |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 fun->shared()->set_is_toplevel(is_toplevel); | 557 fun->shared()->set_is_toplevel(is_toplevel); |
| 556 fun->shared()->set_inferred_name(*lit->inferred_name()); | 558 fun->shared()->set_inferred_name(*lit->inferred_name()); |
| 557 fun->shared()->SetThisPropertyAssignmentsInfo( | 559 fun->shared()->SetThisPropertyAssignmentsInfo( |
| 558 lit->has_only_simple_this_property_assignments(), | 560 lit->has_only_simple_this_property_assignments(), |
| 559 *lit->this_property_assignments()); | 561 *lit->this_property_assignments()); |
| 560 fun->shared()->set_try_full_codegen(lit->try_full_codegen()); | 562 fun->shared()->set_try_full_codegen(lit->try_full_codegen()); |
| 561 } | 563 } |
| 562 | 564 |
| 563 | 565 |
| 564 } } // namespace v8::internal | 566 } } // namespace v8::internal |
| OLD | NEW |