| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 void MarkAsEval() { | 69 void MarkAsEval() { |
| 70 ASSERT(!is_lazy()); | 70 ASSERT(!is_lazy()); |
| 71 flags_ |= IsEval::encode(true); | 71 flags_ |= IsEval::encode(true); |
| 72 } | 72 } |
| 73 void MarkAsGlobal() { | 73 void MarkAsGlobal() { |
| 74 ASSERT(!is_lazy()); | 74 ASSERT(!is_lazy()); |
| 75 flags_ |= IsGlobal::encode(true); | 75 flags_ |= IsGlobal::encode(true); |
| 76 } | 76 } |
| 77 void MarkAsStrict() { | 77 void MarkAsStrict() { |
| 78 ASSERT(!is_lazy()); | |
| 79 flags_ |= IsStrict::encode(true); | 78 flags_ |= IsStrict::encode(true); |
| 80 } | 79 } |
| 81 StrictModeFlag StrictMode() { | 80 StrictModeFlag StrictMode() { |
| 82 return is_strict() ? kStrictMode : kNonStrictMode; | 81 return is_strict() ? kStrictMode : kNonStrictMode; |
| 83 } | 82 } |
| 84 void MarkAsInLoop() { | 83 void MarkAsInLoop() { |
| 85 ASSERT(is_lazy()); | 84 ASSERT(is_lazy()); |
| 86 flags_ |= IsInLoop::encode(true); | 85 flags_ |= IsInLoop::encode(true); |
| 87 } | 86 } |
| 88 void SetFunction(FunctionLiteral* literal) { | 87 void SetFunction(FunctionLiteral* literal) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 enum Mode { | 151 enum Mode { |
| 153 BASE, | 152 BASE, |
| 154 OPTIMIZE, | 153 OPTIMIZE, |
| 155 NONOPT | 154 NONOPT |
| 156 }; | 155 }; |
| 157 | 156 |
| 158 CompilationInfo() : function_(NULL) {} | 157 CompilationInfo() : function_(NULL) {} |
| 159 | 158 |
| 160 void Initialize(Mode mode) { | 159 void Initialize(Mode mode) { |
| 161 mode_ = V8::UseCrankshaft() ? mode : NONOPT; | 160 mode_ = V8::UseCrankshaft() ? mode : NONOPT; |
| 161 if (!shared_info_.is_null() && shared_info_->strict_mode()) { |
| 162 MarkAsStrict(); |
| 163 } |
| 162 } | 164 } |
| 163 | 165 |
| 164 void SetMode(Mode mode) { | 166 void SetMode(Mode mode) { |
| 165 ASSERT(V8::UseCrankshaft()); | 167 ASSERT(V8::UseCrankshaft()); |
| 166 mode_ = mode; | 168 mode_ = mode; |
| 167 } | 169 } |
| 168 | 170 |
| 169 // Flags using template class BitField<type, start, length>. All are | 171 // Flags using template class BitField<type, start, length>. All are |
| 170 // false by default. | 172 // false by default. |
| 171 // | 173 // |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 static void SetFunctionInfo(Handle<SharedFunctionInfo> function_info, | 264 static void SetFunctionInfo(Handle<SharedFunctionInfo> function_info, |
| 263 FunctionLiteral* lit, | 265 FunctionLiteral* lit, |
| 264 bool is_toplevel, | 266 bool is_toplevel, |
| 265 Handle<Script> script); | 267 Handle<Script> script); |
| 266 | 268 |
| 267 #ifdef ENABLE_DEBUGGER_SUPPORT | 269 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 268 static bool MakeCodeForLiveEdit(CompilationInfo* info); | 270 static bool MakeCodeForLiveEdit(CompilationInfo* info); |
| 269 #endif | 271 #endif |
| 270 | 272 |
| 271 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, | 273 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
| 272 Handle<String> name, | 274 CompilationInfo* info, |
| 273 int start_position, | 275 Handle<SharedFunctionInfo> shared); |
| 274 CompilationInfo* info); | |
| 275 }; | 276 }; |
| 276 | 277 |
| 277 | 278 |
| 278 // During compilation we need a global list of handles to constants | 279 // During compilation we need a global list of handles to constants |
| 279 // for frame elements. When the zone gets deleted, we make sure to | 280 // for frame elements. When the zone gets deleted, we make sure to |
| 280 // clear this list of handles as well. | 281 // clear this list of handles as well. |
| 281 class CompilationZoneScope : public ZoneScope { | 282 class CompilationZoneScope : public ZoneScope { |
| 282 public: | 283 public: |
| 283 explicit CompilationZoneScope(ZoneScopeMode mode) : ZoneScope(mode) { } | 284 explicit CompilationZoneScope(ZoneScopeMode mode) : ZoneScope(mode) { } |
| 284 virtual ~CompilationZoneScope() { | 285 virtual ~CompilationZoneScope() { |
| 285 if (ShouldDeleteOnExit()) { | 286 if (ShouldDeleteOnExit()) { |
| 286 Isolate* isolate = Isolate::Current(); | 287 Isolate* isolate = Isolate::Current(); |
| 287 isolate->frame_element_constant_list()->Clear(); | 288 isolate->frame_element_constant_list()->Clear(); |
| 288 isolate->result_constant_list()->Clear(); | 289 isolate->result_constant_list()->Clear(); |
| 289 } | 290 } |
| 290 } | 291 } |
| 291 }; | 292 }; |
| 292 | 293 |
| 293 | 294 |
| 294 } } // namespace v8::internal | 295 } } // namespace v8::internal |
| 295 | 296 |
| 296 #endif // V8_COMPILER_H_ | 297 #endif // V8_COMPILER_H_ |
| OLD | NEW |