OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 9306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9317 // No write barrier required, since the builtin is part of the root set. | 9317 // No write barrier required, since the builtin is part of the root set. |
9318 } | 9318 } |
9319 | 9319 |
9320 | 9320 |
9321 static bool CompileLazyHelper(CompilationInfo* info, | 9321 static bool CompileLazyHelper(CompilationInfo* info, |
9322 ClearExceptionFlag flag) { | 9322 ClearExceptionFlag flag) { |
9323 // Compile the source information to a code object. | 9323 // Compile the source information to a code object. |
9324 ASSERT(info->IsOptimizing() || !info->shared_info()->is_compiled()); | 9324 ASSERT(info->IsOptimizing() || !info->shared_info()->is_compiled()); |
9325 ASSERT(!info->isolate()->has_pending_exception()); | 9325 ASSERT(!info->isolate()->has_pending_exception()); |
9326 bool result = Compiler::CompileLazy(info); | 9326 bool result = Compiler::CompileLazy(info); |
9327 ASSERT(result != info->isolate()->has_pending_exception()); | 9327 ASSERT(result != Isolate::Current()->has_pending_exception()); |
Michael Starzinger
2013/09/09 15:34:44
Please keep using info->isolate() here, Isolate::C
| |
9328 if (!result && flag == CLEAR_EXCEPTION) { | 9328 if (!result && flag == CLEAR_EXCEPTION) { |
9329 info->isolate()->clear_pending_exception(); | 9329 info->isolate()->clear_pending_exception(); |
9330 } | 9330 } |
9331 return result; | 9331 return result; |
9332 } | 9332 } |
9333 | 9333 |
9334 | 9334 |
9335 bool SharedFunctionInfo::CompileLazy(Handle<SharedFunctionInfo> shared, | 9335 bool SharedFunctionInfo::CompileLazy(Handle<SharedFunctionInfo> shared, |
9336 ClearExceptionFlag flag) { | 9336 ClearExceptionFlag flag) { |
9337 ASSERT(shared->allows_lazy_compilation_without_context()); | 9337 ASSERT(shared->allows_lazy_compilation_without_context()); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9486 } else { | 9486 } else { |
9487 ASSERT(function->shared()->allows_lazy_compilation()); | 9487 ASSERT(function->shared()->allows_lazy_compilation()); |
9488 CompilationInfoWithZone info(function); | 9488 CompilationInfoWithZone info(function); |
9489 result = CompileLazyHelper(&info, flag); | 9489 result = CompileLazyHelper(&info, flag); |
9490 ASSERT(!result || function->is_compiled()); | 9490 ASSERT(!result || function->is_compiled()); |
9491 } | 9491 } |
9492 return result; | 9492 return result; |
9493 } | 9493 } |
9494 | 9494 |
9495 | 9495 |
9496 Handle<Code> JSFunction::CompileOsr(Handle<JSFunction> function, | |
9497 BailoutId osr_ast_id, | |
9498 ClearExceptionFlag flag) { | |
9499 CompilationInfoWithZone info(function); | |
9500 info.SetOptimizing(osr_ast_id); | |
9501 if (CompileLazyHelper(&info, flag)) { | |
9502 // TODO(titzer): don't install the OSR code. | |
9503 // ASSERT(function->code() != *info.code()); | |
9504 return info.code(); | |
9505 } else { | |
9506 return Handle<Code>::null(); | |
9507 } | |
9508 } | |
9509 | |
9510 | |
9496 bool JSFunction::CompileOptimized(Handle<JSFunction> function, | 9511 bool JSFunction::CompileOptimized(Handle<JSFunction> function, |
9497 BailoutId osr_ast_id, | |
9498 ClearExceptionFlag flag) { | 9512 ClearExceptionFlag flag) { |
9499 CompilationInfoWithZone info(function); | 9513 CompilationInfoWithZone info(function); |
9500 info.SetOptimizing(osr_ast_id); | 9514 info.SetOptimizing(BailoutId::None()); |
9501 return CompileLazyHelper(&info, flag); | 9515 return CompileLazyHelper(&info, flag); |
9502 } | 9516 } |
9503 | 9517 |
9504 | 9518 |
9505 bool JSFunction::EnsureCompiled(Handle<JSFunction> function, | 9519 bool JSFunction::EnsureCompiled(Handle<JSFunction> function, |
9506 ClearExceptionFlag flag) { | 9520 ClearExceptionFlag flag) { |
9507 return function->is_compiled() || CompileLazy(function, flag); | 9521 return function->is_compiled() || CompileLazy(function, flag); |
9508 } | 9522 } |
9509 | 9523 |
9510 | 9524 |
(...skipping 6537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
16048 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16062 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16049 static const char* error_messages_[] = { | 16063 static const char* error_messages_[] = { |
16050 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16064 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16051 }; | 16065 }; |
16052 #undef ERROR_MESSAGES_TEXTS | 16066 #undef ERROR_MESSAGES_TEXTS |
16053 return error_messages_[reason]; | 16067 return error_messages_[reason]; |
16054 } | 16068 } |
16055 | 16069 |
16056 | 16070 |
16057 } } // namespace v8::internal | 16071 } } // namespace v8::internal |
OLD | NEW |