OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Review notes: | 5 // Review notes: |
6 // | 6 // |
7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
10 // | 10 // |
(...skipping 5930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5941 this->type() == TYPE_WASM) | 5941 this->type() == TYPE_WASM) |
5942 | 5942 |
5943 Script::CompilationType Script::compilation_type() { | 5943 Script::CompilationType Script::compilation_type() { |
5944 return BooleanBit::get(flags(), kCompilationTypeBit) ? | 5944 return BooleanBit::get(flags(), kCompilationTypeBit) ? |
5945 COMPILATION_TYPE_EVAL : COMPILATION_TYPE_HOST; | 5945 COMPILATION_TYPE_EVAL : COMPILATION_TYPE_HOST; |
5946 } | 5946 } |
5947 void Script::set_compilation_type(CompilationType type) { | 5947 void Script::set_compilation_type(CompilationType type) { |
5948 set_flags(BooleanBit::set(flags(), kCompilationTypeBit, | 5948 set_flags(BooleanBit::set(flags(), kCompilationTypeBit, |
5949 type == COMPILATION_TYPE_EVAL)); | 5949 type == COMPILATION_TYPE_EVAL)); |
5950 } | 5950 } |
| 5951 bool Script::hide_source() { return BooleanBit::get(flags(), kHideSourceBit); } |
| 5952 void Script::set_hide_source(bool value) { |
| 5953 set_flags(BooleanBit::set(flags(), kHideSourceBit, value)); |
| 5954 } |
5951 Script::CompilationState Script::compilation_state() { | 5955 Script::CompilationState Script::compilation_state() { |
5952 return BooleanBit::get(flags(), kCompilationStateBit) ? | 5956 return BooleanBit::get(flags(), kCompilationStateBit) ? |
5953 COMPILATION_STATE_COMPILED : COMPILATION_STATE_INITIAL; | 5957 COMPILATION_STATE_COMPILED : COMPILATION_STATE_INITIAL; |
5954 } | 5958 } |
5955 void Script::set_compilation_state(CompilationState state) { | 5959 void Script::set_compilation_state(CompilationState state) { |
5956 set_flags(BooleanBit::set(flags(), kCompilationStateBit, | 5960 set_flags(BooleanBit::set(flags(), kCompilationStateBit, |
5957 state == COMPILATION_STATE_COMPILED)); | 5961 state == COMPILATION_STATE_COMPILED)); |
5958 } | 5962 } |
5959 ScriptOriginOptions Script::origin_options() { | 5963 ScriptOriginOptions Script::origin_options() { |
5960 return ScriptOriginOptions((flags() & kOriginOptionsMask) >> | 5964 return ScriptOriginOptions((flags() & kOriginOptionsMask) >> |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6486 set_deopt_count(0); | 6490 set_deopt_count(0); |
6487 } | 6491 } |
6488 } | 6492 } |
6489 | 6493 |
6490 | 6494 |
6491 void SharedFunctionInfo::set_disable_optimization_reason(BailoutReason reason) { | 6495 void SharedFunctionInfo::set_disable_optimization_reason(BailoutReason reason) { |
6492 set_opt_count_and_bailout_reason(DisabledOptimizationReasonBits::update( | 6496 set_opt_count_and_bailout_reason(DisabledOptimizationReasonBits::update( |
6493 opt_count_and_bailout_reason(), reason)); | 6497 opt_count_and_bailout_reason(), reason)); |
6494 } | 6498 } |
6495 | 6499 |
6496 bool SharedFunctionInfo::IsUserJavaScript() { | 6500 |
| 6501 bool SharedFunctionInfo::IsBuiltin() { |
6497 Object* script_obj = script(); | 6502 Object* script_obj = script(); |
6498 if (script_obj->IsUndefined(GetIsolate())) return false; | 6503 if (script_obj->IsUndefined(GetIsolate())) return true; |
6499 Script* script = Script::cast(script_obj); | 6504 Script* script = Script::cast(script_obj); |
6500 return static_cast<Script::Type>(script->type()) == Script::TYPE_NORMAL; | 6505 Script::Type type = static_cast<Script::Type>(script->type()); |
| 6506 return type != Script::TYPE_NORMAL; |
6501 } | 6507 } |
6502 | 6508 |
6503 bool SharedFunctionInfo::IsSubjectToDebugging() { | 6509 bool SharedFunctionInfo::IsSubjectToDebugging() { |
6504 return IsUserJavaScript() && !HasAsmWasmData(); | 6510 return !IsBuiltin() && !HasAsmWasmData(); |
6505 } | 6511 } |
6506 | 6512 |
6507 bool SharedFunctionInfo::OptimizedCodeMapIsCleared() const { | 6513 bool SharedFunctionInfo::OptimizedCodeMapIsCleared() const { |
6508 return optimized_code_map() == GetHeap()->empty_fixed_array(); | 6514 return optimized_code_map() == GetHeap()->empty_fixed_array(); |
6509 } | 6515 } |
6510 | 6516 |
6511 | 6517 |
6512 bool JSFunction::IsOptimized() { | 6518 bool JSFunction::IsOptimized() { |
6513 return code()->kind() == Code::OPTIMIZED_FUNCTION; | 6519 return code()->kind() == Code::OPTIMIZED_FUNCTION; |
6514 } | 6520 } |
(...skipping 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8434 #undef WRITE_INT64_FIELD | 8440 #undef WRITE_INT64_FIELD |
8435 #undef READ_BYTE_FIELD | 8441 #undef READ_BYTE_FIELD |
8436 #undef WRITE_BYTE_FIELD | 8442 #undef WRITE_BYTE_FIELD |
8437 #undef NOBARRIER_READ_BYTE_FIELD | 8443 #undef NOBARRIER_READ_BYTE_FIELD |
8438 #undef NOBARRIER_WRITE_BYTE_FIELD | 8444 #undef NOBARRIER_WRITE_BYTE_FIELD |
8439 | 8445 |
8440 } // namespace internal | 8446 } // namespace internal |
8441 } // namespace v8 | 8447 } // namespace v8 |
8442 | 8448 |
8443 #endif // V8_OBJECTS_INL_H_ | 8449 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |