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/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 5341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5352 break; | 5352 break; |
5353 case RawFunction::kMethodExtractor: | 5353 case RawFunction::kMethodExtractor: |
5354 return "kMethodExtractor"; | 5354 return "kMethodExtractor"; |
5355 break; | 5355 break; |
5356 case RawFunction::kNoSuchMethodDispatcher: | 5356 case RawFunction::kNoSuchMethodDispatcher: |
5357 return "kNoSuchMethodDispatcher"; | 5357 return "kNoSuchMethodDispatcher"; |
5358 break; | 5358 break; |
5359 case RawFunction::kInvokeFieldDispatcher: | 5359 case RawFunction::kInvokeFieldDispatcher: |
5360 return "kInvokeFieldDispatcher"; | 5360 return "kInvokeFieldDispatcher"; |
5361 break; | 5361 break; |
5362 case RawFunction::kIrregexpFunction: | |
5363 return "kIrregexpFunction"; | |
5364 break; | |
5362 default: | 5365 default: |
5363 UNREACHABLE(); | 5366 UNREACHABLE(); |
5364 return NULL; | 5367 return NULL; |
5365 } | 5368 } |
5366 } | 5369 } |
5367 | 5370 |
5368 | 5371 |
5369 void Function::SetRedirectionType(const Type& type) const { | 5372 void Function::SetRedirectionType(const Type& type) const { |
5370 ASSERT(IsFactory()); | 5373 ASSERT(IsFactory()); |
5371 Object& obj = Object::Handle(raw_ptr()->data_); | 5374 Object& obj = Object::Handle(raw_ptr()->data_); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5437 StorePointer(&raw_ptr()->name_, value.raw()); | 5440 StorePointer(&raw_ptr()->name_, value.raw()); |
5438 } | 5441 } |
5439 | 5442 |
5440 | 5443 |
5441 void Function::set_owner(const Object& value) const { | 5444 void Function::set_owner(const Object& value) const { |
5442 ASSERT(!value.IsNull()); | 5445 ASSERT(!value.IsNull()); |
5443 StorePointer(&raw_ptr()->owner_, value.raw()); | 5446 StorePointer(&raw_ptr()->owner_, value.raw()); |
5444 } | 5447 } |
5445 | 5448 |
5446 | 5449 |
5450 RawJSRegExp* Function::regexp() const { | |
5451 ASSERT(kind() == RawFunction::kIrregexpFunction); | |
5452 const Object& obj = Object::Handle(raw_ptr()->data_); | |
5453 ASSERT(obj.IsJSRegExp()); | |
5454 return JSRegExp::Cast(obj).raw(); | |
5455 } | |
5456 | |
5457 | |
5458 void Function::set_regexp(const JSRegExp& value) const { | |
5459 ASSERT(kind() == RawFunction::kIrregexpFunction); | |
5460 ASSERT(raw_ptr()->data_ == Object::null()); | |
5461 set_data(value); | |
5462 } | |
5463 | |
Ivan Posva
2014/11/03 08:52:21
two lines
zerny-google
2014/11/03 14:03:41
Done.
| |
5464 void Function::set_regexp_cid(intptr_t regexp_cid) const { | |
5465 StoreNonPointer(&raw_ptr()->regexp_cid_, regexp_cid); | |
Ivan Posva
2014/11/03 08:52:21
The cid should be asserted to be a string only cid
zerny-google
2014/11/03 14:03:41
Done.
| |
5466 } | |
5467 | |
Ivan Posva
2014/11/03 08:52:21
two lines
zerny-google
2014/11/03 14:03:41
Done.
| |
5447 void Function::set_result_type(const AbstractType& value) const { | 5468 void Function::set_result_type(const AbstractType& value) const { |
5448 ASSERT(!value.IsNull()); | 5469 ASSERT(!value.IsNull()); |
5449 StorePointer(&raw_ptr()->result_type_, value.raw()); | 5470 StorePointer(&raw_ptr()->result_type_, value.raw()); |
5450 } | 5471 } |
5451 | 5472 |
5452 | 5473 |
5453 RawAbstractType* Function::ParameterTypeAt(intptr_t index) const { | 5474 RawAbstractType* Function::ParameterTypeAt(intptr_t index) const { |
5454 const Array& parameter_types = Array::Handle(raw_ptr()->parameter_types_); | 5475 const Array& parameter_types = Array::Handle(raw_ptr()->parameter_types_); |
5455 return AbstractType::RawCast(parameter_types.At(index)); | 5476 return AbstractType::RawCast(parameter_types.At(index)); |
5456 } | 5477 } |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6116 result.set_is_redirecting(false); | 6137 result.set_is_redirecting(false); |
6117 result.set_is_async_closure(false); | 6138 result.set_is_async_closure(false); |
6118 result.set_always_inline(false); | 6139 result.set_always_inline(false); |
6119 result.set_is_polymorphic_target(false); | 6140 result.set_is_polymorphic_target(false); |
6120 result.set_owner(owner); | 6141 result.set_owner(owner); |
6121 result.set_token_pos(token_pos); | 6142 result.set_token_pos(token_pos); |
6122 result.set_end_token_pos(token_pos); | 6143 result.set_end_token_pos(token_pos); |
6123 result.set_num_fixed_parameters(0); | 6144 result.set_num_fixed_parameters(0); |
6124 result.set_num_optional_parameters(0); | 6145 result.set_num_optional_parameters(0); |
6125 result.set_usage_counter(0); | 6146 result.set_usage_counter(0); |
6126 result.set_deoptimization_counter(0); | 6147 result.set_deoptimization_counter(0); |
Ivan Posva
2014/11/03 08:52:21
cid value is not being initialized here and simila
zerny-google
2014/11/03 14:03:41
Done.
| |
6127 result.set_optimized_instruction_count(0); | 6148 result.set_optimized_instruction_count(0); |
6128 result.set_optimized_call_site_count(0); | 6149 result.set_optimized_call_site_count(0); |
6129 result.set_is_optimizable(is_native ? false : true); | 6150 result.set_is_optimizable(is_native ? false : true); |
6130 result.set_is_inlinable(true); | 6151 result.set_is_inlinable(true); |
6131 result.set_allows_hoisting_check_class(true); | 6152 result.set_allows_hoisting_check_class(true); |
6132 result.set_allows_bounds_check_generalization(true); | 6153 result.set_allows_bounds_check_generalization(true); |
6133 StubCode* stub_code = Isolate::Current()->stub_code(); | 6154 StubCode* stub_code = Isolate::Current()->stub_code(); |
6134 result.SetInstructions(Code::Handle(stub_code->LazyCompile_entry()->code())); | 6155 result.SetInstructions(Code::Handle(stub_code->LazyCompile_entry()->code())); |
6135 if (kind == RawFunction::kClosureFunction) { | 6156 if (kind == RawFunction::kClosureFunction) { |
6136 const ClosureData& data = ClosureData::Handle(ClosureData::New()); | 6157 const ClosureData& data = ClosureData::Handle(ClosureData::New()); |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6697 break; | 6718 break; |
6698 case RawFunction::kMethodExtractor: | 6719 case RawFunction::kMethodExtractor: |
6699 kind_str = " method-extractor"; | 6720 kind_str = " method-extractor"; |
6700 break; | 6721 break; |
6701 case RawFunction::kNoSuchMethodDispatcher: | 6722 case RawFunction::kNoSuchMethodDispatcher: |
6702 kind_str = " no-such-method-dispatcher"; | 6723 kind_str = " no-such-method-dispatcher"; |
6703 break; | 6724 break; |
6704 case RawFunction::kInvokeFieldDispatcher: | 6725 case RawFunction::kInvokeFieldDispatcher: |
6705 kind_str = "invoke-field-dispatcher"; | 6726 kind_str = "invoke-field-dispatcher"; |
6706 break; | 6727 break; |
6728 case RawFunction::kIrregexpFunction: | |
6729 kind_str = "irregexp-function"; | |
6730 break; | |
6707 default: | 6731 default: |
6708 UNREACHABLE(); | 6732 UNREACHABLE(); |
6709 } | 6733 } |
6710 const char* kFormat = "Function '%s':%s%s%s%s."; | 6734 const char* kFormat = "Function '%s':%s%s%s%s."; |
6711 const char* function_name = String::Handle(name()).ToCString(); | 6735 const char* function_name = String::Handle(name()).ToCString(); |
6712 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, | 6736 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, |
6713 static_str, abstract_str, kind_str, const_str) + 1; | 6737 static_str, abstract_str, kind_str, const_str) + 1; |
6714 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 6738 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
6715 OS::SNPrint(chars, len, kFormat, function_name, | 6739 OS::SNPrint(chars, len, kFormat, function_name, |
6716 static_str, abstract_str, kind_str, const_str); | 6740 static_str, abstract_str, kind_str, const_str); |
(...skipping 3656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10373 OS::Print("Function not found %s.%s\n", #class_name, #function_name); \ | 10397 OS::Print("Function not found %s.%s\n", #class_name, #function_name); \ |
10374 } else if (func.SourceFingerprint() != fp) { \ | 10398 } else if (func.SourceFingerprint() != fp) { \ |
10375 has_errors = true; \ | 10399 has_errors = true; \ |
10376 OS::Print("Wrong fingerprint for '%s': expecting %d found %d\n", \ | 10400 OS::Print("Wrong fingerprint for '%s': expecting %d found %d\n", \ |
10377 func.ToFullyQualifiedCString(), fp, func.SourceFingerprint()); \ | 10401 func.ToFullyQualifiedCString(), fp, func.SourceFingerprint()); \ |
10378 collected_fp_diffs.Add(FpDiff(fp, func.SourceFingerprint())); \ | 10402 collected_fp_diffs.Add(FpDiff(fp, func.SourceFingerprint())); \ |
10379 } \ | 10403 } \ |
10380 | 10404 |
10381 all_libs.Add(&Library::ZoneHandle(Library::CoreLibrary())); | 10405 all_libs.Add(&Library::ZoneHandle(Library::CoreLibrary())); |
10382 CORE_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); | 10406 CORE_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); |
10407 CORE_REGEXP_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); | |
10383 CORE_INTEGER_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); | 10408 CORE_INTEGER_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); |
10384 | 10409 |
10385 all_libs.Add(&Library::ZoneHandle(Library::MathLibrary())); | 10410 all_libs.Add(&Library::ZoneHandle(Library::MathLibrary())); |
10386 all_libs.Add(&Library::ZoneHandle(Library::TypedDataLibrary())); | 10411 all_libs.Add(&Library::ZoneHandle(Library::TypedDataLibrary())); |
10387 OTHER_RECOGNIZED_LIST(CHECK_FINGERPRINTS); | 10412 OTHER_RECOGNIZED_LIST(CHECK_FINGERPRINTS); |
10388 INLINE_WHITE_LIST(CHECK_FINGERPRINTS); | 10413 INLINE_WHITE_LIST(CHECK_FINGERPRINTS); |
10389 POLYMORPHIC_TARGET_LIST(CHECK_FINGERPRINTS); | 10414 POLYMORPHIC_TARGET_LIST(CHECK_FINGERPRINTS); |
10390 | 10415 |
10391 all_libs.Clear(); | 10416 all_libs.Clear(); |
10392 all_libs.Add(&Library::ZoneHandle(Library::MathLibrary())); | 10417 all_libs.Add(&Library::ZoneHandle(Library::MathLibrary())); |
(...skipping 9574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
19967 chars[total_len] = '\0'; | 19992 chars[total_len] = '\0'; |
19968 return chars; | 19993 return chars; |
19969 } | 19994 } |
19970 | 19995 |
19971 | 19996 |
19972 void JSRegExp::set_pattern(const String& pattern) const { | 19997 void JSRegExp::set_pattern(const String& pattern) const { |
19973 StorePointer(&raw_ptr()->pattern_, pattern.raw()); | 19998 StorePointer(&raw_ptr()->pattern_, pattern.raw()); |
19974 } | 19999 } |
19975 | 20000 |
19976 | 20001 |
20002 void JSRegExp::set_function(intptr_t cid, const Function& value) const { | |
20003 StorePointer(FunctionAddr(cid), value.raw()); | |
20004 } | |
20005 | |
20006 | |
19977 void JSRegExp::set_num_bracket_expressions(intptr_t value) const { | 20007 void JSRegExp::set_num_bracket_expressions(intptr_t value) const { |
19978 StoreSmi(&raw_ptr()->num_bracket_expressions_, Smi::New(value)); | 20008 StoreSmi(&raw_ptr()->num_bracket_expressions_, Smi::New(value)); |
19979 } | 20009 } |
19980 | 20010 |
19981 | 20011 |
19982 RawJSRegExp* JSRegExp::New(intptr_t len, Heap::Space space) { | 20012 RawJSRegExp* JSRegExp::New(intptr_t len, Heap::Space space) { |
19983 if (len < 0 || len > kMaxElements) { | 20013 if (len < 0 || len > kMaxElements) { |
19984 // This should be caught before we reach here. | 20014 // This should be caught before we reach here. |
19985 FATAL1("Fatal error in JSRegexp::New: invalid len %" Pd "\n", len); | 20015 FATAL1("Fatal error in JSRegexp::New: invalid len %" Pd "\n", len); |
19986 } | 20016 } |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
20303 return tag_label.ToCString(); | 20333 return tag_label.ToCString(); |
20304 } | 20334 } |
20305 | 20335 |
20306 | 20336 |
20307 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20337 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
20308 Instance::PrintJSONImpl(stream, ref); | 20338 Instance::PrintJSONImpl(stream, ref); |
20309 } | 20339 } |
20310 | 20340 |
20311 | 20341 |
20312 } // namespace dart | 20342 } // namespace dart |
OLD | NEW |