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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 v8::Extension* extension, | 103 v8::Extension* extension, |
104 ScriptDataImpl* pre_data) { | 104 ScriptDataImpl* pre_data) { |
105 CompilationZoneScope zone_scope(DELETE_ON_EXIT); | 105 CompilationZoneScope zone_scope(DELETE_ON_EXIT); |
106 | 106 |
107 // Make sure we have an initial stack limit. | 107 // Make sure we have an initial stack limit. |
108 StackGuard guard; | 108 StackGuard guard; |
109 PostponeInterruptsScope postpone; | 109 PostponeInterruptsScope postpone; |
110 | 110 |
111 ASSERT(!i::Top::global_context().is_null()); | 111 ASSERT(!i::Top::global_context().is_null()); |
112 script->set_context_data((*i::Top::global_context())->data()); | 112 script->set_context_data((*i::Top::global_context())->data()); |
| 113 |
113 #ifdef ENABLE_DEBUGGER_SUPPORT | 114 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 115 if (is_eval || is_json) { |
| 116 script->set_compilation_type( |
| 117 is_json ? Smi::FromInt(Script::COMPILATION_TYPE_JSON) : |
| 118 Smi::FromInt(Script::COMPILATION_TYPE_EVAL)); |
| 119 // For eval scripts add information on the function from which eval was |
| 120 // called. |
| 121 if (is_eval) { |
| 122 JavaScriptFrameIterator it; |
| 123 script->set_eval_from_function(it.frame()->function()); |
| 124 int offset = it.frame()->pc() - it.frame()->code()->instruction_start(); |
| 125 script->set_eval_from_instructions_offset(Smi::FromInt(offset)); |
| 126 } |
| 127 } |
| 128 |
114 // Notify debugger | 129 // Notify debugger |
115 Debugger::OnBeforeCompile(script); | 130 Debugger::OnBeforeCompile(script); |
116 #endif | 131 #endif |
117 | 132 |
118 // Only allow non-global compiles for eval. | 133 // Only allow non-global compiles for eval. |
119 ASSERT(is_eval || is_global); | 134 ASSERT(is_eval || is_global); |
120 | 135 |
121 // Build AST. | 136 // Build AST. |
122 FunctionLiteral* lit = MakeAST(is_global, script, extension, pre_data); | 137 FunctionLiteral* lit = MakeAST(is_global, script, extension, pre_data); |
123 | 138 |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 // Set the expected number of properties for instances. | 400 // Set the expected number of properties for instances. |
386 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); | 401 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); |
387 | 402 |
388 // Check the function has compiled code. | 403 // Check the function has compiled code. |
389 ASSERT(shared->is_compiled()); | 404 ASSERT(shared->is_compiled()); |
390 return true; | 405 return true; |
391 } | 406 } |
392 | 407 |
393 | 408 |
394 } } // namespace v8::internal | 409 } } // namespace v8::internal |
OLD | NEW |