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 } | |
5955 Script::CompilationState Script::compilation_state() { | 5951 Script::CompilationState Script::compilation_state() { |
5956 return BooleanBit::get(flags(), kCompilationStateBit) ? | 5952 return BooleanBit::get(flags(), kCompilationStateBit) ? |
5957 COMPILATION_STATE_COMPILED : COMPILATION_STATE_INITIAL; | 5953 COMPILATION_STATE_COMPILED : COMPILATION_STATE_INITIAL; |
5958 } | 5954 } |
5959 void Script::set_compilation_state(CompilationState state) { | 5955 void Script::set_compilation_state(CompilationState state) { |
5960 set_flags(BooleanBit::set(flags(), kCompilationStateBit, | 5956 set_flags(BooleanBit::set(flags(), kCompilationStateBit, |
5961 state == COMPILATION_STATE_COMPILED)); | 5957 state == COMPILATION_STATE_COMPILED)); |
5962 } | 5958 } |
5963 ScriptOriginOptions Script::origin_options() { | 5959 ScriptOriginOptions Script::origin_options() { |
5964 return ScriptOriginOptions((flags() & kOriginOptionsMask) >> | 5960 return ScriptOriginOptions((flags() & kOriginOptionsMask) >> |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6490 set_deopt_count(0); | 6486 set_deopt_count(0); |
6491 } | 6487 } |
6492 } | 6488 } |
6493 | 6489 |
6494 | 6490 |
6495 void SharedFunctionInfo::set_disable_optimization_reason(BailoutReason reason) { | 6491 void SharedFunctionInfo::set_disable_optimization_reason(BailoutReason reason) { |
6496 set_opt_count_and_bailout_reason(DisabledOptimizationReasonBits::update( | 6492 set_opt_count_and_bailout_reason(DisabledOptimizationReasonBits::update( |
6497 opt_count_and_bailout_reason(), reason)); | 6493 opt_count_and_bailout_reason(), reason)); |
6498 } | 6494 } |
6499 | 6495 |
6500 | 6496 bool SharedFunctionInfo::IsUserJavaScript() { |
6501 bool SharedFunctionInfo::IsBuiltin() { | |
6502 Object* script_obj = script(); | 6497 Object* script_obj = script(); |
6503 if (script_obj->IsUndefined(GetIsolate())) return true; | 6498 if (script_obj->IsUndefined(GetIsolate())) return false; |
6504 Script* script = Script::cast(script_obj); | 6499 Script* script = Script::cast(script_obj); |
6505 Script::Type type = static_cast<Script::Type>(script->type()); | 6500 return static_cast<Script::Type>(script->type()) == Script::TYPE_NORMAL; |
6506 return type != Script::TYPE_NORMAL; | |
6507 } | 6501 } |
6508 | 6502 |
6509 bool SharedFunctionInfo::IsSubjectToDebugging() { | 6503 bool SharedFunctionInfo::IsSubjectToDebugging() { |
6510 return !IsBuiltin() && !HasAsmWasmData(); | 6504 return IsUserJavaScript() && !HasAsmWasmData(); |
6511 } | 6505 } |
6512 | 6506 |
6513 bool SharedFunctionInfo::OptimizedCodeMapIsCleared() const { | 6507 bool SharedFunctionInfo::OptimizedCodeMapIsCleared() const { |
6514 return optimized_code_map() == GetHeap()->empty_fixed_array(); | 6508 return optimized_code_map() == GetHeap()->empty_fixed_array(); |
6515 } | 6509 } |
6516 | 6510 |
6517 | 6511 |
6518 bool JSFunction::IsOptimized() { | 6512 bool JSFunction::IsOptimized() { |
6519 return code()->kind() == Code::OPTIMIZED_FUNCTION; | 6513 return code()->kind() == Code::OPTIMIZED_FUNCTION; |
6520 } | 6514 } |
(...skipping 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8440 #undef WRITE_INT64_FIELD | 8434 #undef WRITE_INT64_FIELD |
8441 #undef READ_BYTE_FIELD | 8435 #undef READ_BYTE_FIELD |
8442 #undef WRITE_BYTE_FIELD | 8436 #undef WRITE_BYTE_FIELD |
8443 #undef NOBARRIER_READ_BYTE_FIELD | 8437 #undef NOBARRIER_READ_BYTE_FIELD |
8444 #undef NOBARRIER_WRITE_BYTE_FIELD | 8438 #undef NOBARRIER_WRITE_BYTE_FIELD |
8445 | 8439 |
8446 } // namespace internal | 8440 } // namespace internal |
8447 } // namespace v8 | 8441 } // namespace v8 |
8448 | 8442 |
8449 #endif // V8_OBJECTS_INL_H_ | 8443 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |