| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/compiler.h" | 5 #include "vm/compiler.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 | 8 |
| 9 #include "vm/ast_printer.h" | 9 #include "vm/ast_printer.h" |
| 10 #include "vm/block_scheduler.h" | 10 #include "vm/block_scheduler.h" |
| (...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1368 void Compiler::ComputeLocalVarDescriptors(const Code& code) { | 1368 void Compiler::ComputeLocalVarDescriptors(const Code& code) { |
| 1369 ASSERT(!code.is_optimized()); | 1369 ASSERT(!code.is_optimized()); |
| 1370 const Function& function = Function::Handle(code.function()); | 1370 const Function& function = Function::Handle(code.function()); |
| 1371 ParsedFunction* parsed_function = new ParsedFunction( | 1371 ParsedFunction* parsed_function = new ParsedFunction( |
| 1372 Thread::Current(), Function::ZoneHandle(function.raw())); | 1372 Thread::Current(), Function::ZoneHandle(function.raw())); |
| 1373 LocalVarDescriptors& var_descs = | 1373 LocalVarDescriptors& var_descs = |
| 1374 LocalVarDescriptors::Handle(code.var_descriptors()); | 1374 LocalVarDescriptors::Handle(code.var_descriptors()); |
| 1375 ASSERT(var_descs.IsNull()); | 1375 ASSERT(var_descs.IsNull()); |
| 1376 // IsIrregexpFunction have eager var descriptors generation. | 1376 // IsIrregexpFunction have eager var descriptors generation. |
| 1377 ASSERT(!function.IsIrregexpFunction()); | 1377 ASSERT(!function.IsIrregexpFunction()); |
| 1378 // Parser should not produce any errors, therefore no LongJumpScope needed. | 1378 // In background compilation, parser can produce 'errors": bailouts |
| 1379 // (exception is background compilation). | 1379 // if state changed while compiling in background. |
| 1380 ASSERT(!Compiler::IsBackgroundCompilation()); | 1380 LongJumpScope jump; |
| 1381 Parser::ParseFunction(parsed_function); | 1381 if (setjmp(*jump.Set()) == 0) { |
| 1382 parsed_function->AllocateVariables(); | 1382 Parser::ParseFunction(parsed_function); |
| 1383 var_descs = parsed_function->node_sequence()->scope()-> | 1383 parsed_function->AllocateVariables(); |
| 1384 GetVarDescriptors(function); | 1384 var_descs = parsed_function->node_sequence()->scope()-> |
| 1385 ASSERT(!var_descs.IsNull()); | 1385 GetVarDescriptors(function); |
| 1386 code.set_var_descriptors(var_descs); | 1386 ASSERT(!var_descs.IsNull()); |
| 1387 code.set_var_descriptors(var_descs); |
| 1388 } else { |
| 1389 // Only possible with background compilation. |
| 1390 ASSERT(Compiler::IsBackgroundCompilation()); |
| 1391 } |
| 1387 } | 1392 } |
| 1388 | 1393 |
| 1389 | 1394 |
| 1390 RawError* Compiler::CompileAllFunctions(const Class& cls) { | 1395 RawError* Compiler::CompileAllFunctions(const Class& cls) { |
| 1391 Thread* thread = Thread::Current(); | 1396 Thread* thread = Thread::Current(); |
| 1392 Zone* zone = thread->zone(); | 1397 Zone* zone = thread->zone(); |
| 1393 Error& error = Error::Handle(zone); | 1398 Error& error = Error::Handle(zone); |
| 1394 Array& functions = Array::Handle(zone, cls.functions()); | 1399 Array& functions = Array::Handle(zone, cls.functions()); |
| 1395 Function& func = Function::Handle(zone); | 1400 Function& func = Function::Handle(zone); |
| 1396 // Class dynamic lives in the vm isolate. Its array fields cannot be set to | 1401 // Class dynamic lives in the vm isolate. Its array fields cannot be set to |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1905 } | 1910 } |
| 1906 | 1911 |
| 1907 | 1912 |
| 1908 void BackgroundCompiler::EnsureInit(Thread* thread) { | 1913 void BackgroundCompiler::EnsureInit(Thread* thread) { |
| 1909 UNREACHABLE(); | 1914 UNREACHABLE(); |
| 1910 } | 1915 } |
| 1911 | 1916 |
| 1912 #endif // DART_PRECOMPILED_RUNTIME | 1917 #endif // DART_PRECOMPILED_RUNTIME |
| 1913 | 1918 |
| 1914 } // namespace dart | 1919 } // namespace dart |
| OLD | NEW |