| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 | 354 |
| 355 // NOTE: Need to pass 'result' as a parameter here in order to avoid | 355 // NOTE: Need to pass 'result' as a parameter here in order to avoid |
| 356 // warning: variable 'result' might be clobbered by 'longjmp' or 'vfork' | 356 // warning: variable 'result' might be clobbered by 'longjmp' or 'vfork' |
| 357 // which shows up because of the use of setjmp. | 357 // which shows up because of the use of setjmp. |
| 358 static void CompileSource(Isolate* isolate, | 358 static void CompileSource(Isolate* isolate, |
| 359 const Library& lib, | 359 const Library& lib, |
| 360 const String& url, | 360 const String& url, |
| 361 const String& source, | 361 const String& source, |
| 362 RawScript::Kind kind, | 362 RawScript::Kind kind, |
| 363 Dart_Handle* result) { | 363 Dart_Handle* result) { |
| 364 bool update_lib_status = (kind == RawScript::kScript || |
| 365 kind == RawScript::kLibrary); |
| 366 if (update_lib_status) { |
| 367 lib.SetLoadInProgress(); |
| 368 } |
| 364 const Script& script = Script::Handle(Script::New(url, source, kind)); | 369 const Script& script = Script::Handle(Script::New(url, source, kind)); |
| 365 ASSERT(isolate != NULL); | 370 ASSERT(isolate != NULL); |
| 366 LongJump* base = isolate->long_jump_base(); | 371 LongJump* base = isolate->long_jump_base(); |
| 367 LongJump jump; | 372 LongJump jump; |
| 368 isolate->set_long_jump_base(&jump); | 373 isolate->set_long_jump_base(&jump); |
| 369 if (setjmp(*jump.Set()) == 0) { | 374 if (setjmp(*jump.Set()) == 0) { |
| 370 Compiler::Compile(lib, script); | 375 Compiler::Compile(lib, script); |
| 371 *result = Api::NewLocalHandle(lib); | 376 *result = Api::NewLocalHandle(lib); |
| 377 if (update_lib_status) { |
| 378 lib.SetLoaded(); |
| 379 } |
| 372 } else { | 380 } else { |
| 373 SetupErrorResult(result); | 381 SetupErrorResult(result); |
| 382 if (update_lib_status) { |
| 383 lib.SetLoadError(); |
| 384 } |
| 374 } | 385 } |
| 375 isolate->set_long_jump_base(base); | 386 isolate->set_long_jump_base(base); |
| 376 } | 387 } |
| 377 | 388 |
| 378 | 389 |
| 379 DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url, | 390 DART_EXPORT Dart_Handle Dart_LoadScript(Dart_Handle url, |
| 380 Dart_Handle source, | 391 Dart_Handle source, |
| 381 Dart_LibraryTagHandler handler) { | 392 Dart_LibraryTagHandler handler) { |
| 382 Isolate* isolate = Isolate::Current(); | 393 Isolate* isolate = Isolate::Current(); |
| 383 DARTSCOPE(isolate); | 394 DARTSCOPE(isolate); |
| (...skipping 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2133 ASSERT(isolate != NULL); | 2144 ASSERT(isolate != NULL); |
| 2134 ApiState* state = isolate->api_state(); | 2145 ApiState* state = isolate->api_state(); |
| 2135 ASSERT(state != NULL); | 2146 ASSERT(state != NULL); |
| 2136 ApiLocalScope* scope = state->top_scope(); | 2147 ApiLocalScope* scope = state->top_scope(); |
| 2137 ASSERT(scope != NULL); | 2148 ASSERT(scope != NULL); |
| 2138 return scope->zone().Reallocate(ptr, old_size, new_size); | 2149 return scope->zone().Reallocate(ptr, old_size, new_size); |
| 2139 } | 2150 } |
| 2140 | 2151 |
| 2141 | 2152 |
| 2142 } // namespace dart | 2153 } // namespace dart |
| OLD | NEW |