Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/objects.cc

Issue 10041025: Merged r11143, r11162, r11174, r11208, r11213, r11222 into 3.9 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.9
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 case EXTERNAL_PIXEL_ARRAY_TYPE: 1383 case EXTERNAL_PIXEL_ARRAY_TYPE:
1384 case EXTERNAL_BYTE_ARRAY_TYPE: 1384 case EXTERNAL_BYTE_ARRAY_TYPE:
1385 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: 1385 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
1386 case EXTERNAL_SHORT_ARRAY_TYPE: 1386 case EXTERNAL_SHORT_ARRAY_TYPE:
1387 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: 1387 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
1388 case EXTERNAL_INT_ARRAY_TYPE: 1388 case EXTERNAL_INT_ARRAY_TYPE:
1389 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: 1389 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
1390 case EXTERNAL_FLOAT_ARRAY_TYPE: 1390 case EXTERNAL_FLOAT_ARRAY_TYPE:
1391 case EXTERNAL_DOUBLE_ARRAY_TYPE: 1391 case EXTERNAL_DOUBLE_ARRAY_TYPE:
1392 break; 1392 break;
1393 case SHARED_FUNCTION_INFO_TYPE: 1393 case SHARED_FUNCTION_INFO_TYPE: {
1394 SharedFunctionInfo::BodyDescriptor::IterateBody(this, v); 1394 SharedFunctionInfo* shared = reinterpret_cast<SharedFunctionInfo*>(this);
1395 shared->SharedFunctionInfoIterateBody(v);
1395 break; 1396 break;
1397 }
1396 1398
1397 #define MAKE_STRUCT_CASE(NAME, Name, name) \ 1399 #define MAKE_STRUCT_CASE(NAME, Name, name) \
1398 case NAME##_TYPE: 1400 case NAME##_TYPE:
1399 STRUCT_LIST(MAKE_STRUCT_CASE) 1401 STRUCT_LIST(MAKE_STRUCT_CASE)
1400 #undef MAKE_STRUCT_CASE 1402 #undef MAKE_STRUCT_CASE
1401 StructBodyDescriptor::IterateBody(this, object_size, v); 1403 StructBodyDescriptor::IterateBody(this, object_size, v);
1402 break; 1404 break;
1403 default: 1405 default:
1404 PrintF("Unknown type: %d\n", type); 1406 PrintF("Unknown type: %d\n", type);
1405 UNREACHABLE(); 1407 UNREACHABLE();
(...skipping 6456 matching lines...) Expand 10 before | Expand all | Expand 10 after
7862 set_initial_map(map); 7864 set_initial_map(map);
7863 Builtins* builtins = map->GetHeap()->isolate()->builtins(); 7865 Builtins* builtins = map->GetHeap()->isolate()->builtins();
7864 ASSERT_EQ(builtins->builtin(Builtins::kJSConstructStubGeneric), 7866 ASSERT_EQ(builtins->builtin(Builtins::kJSConstructStubGeneric),
7865 *RawField(this, kConstructStubOffset)); 7867 *RawField(this, kConstructStubOffset));
7866 set_construct_stub(builtins->builtin(Builtins::kJSConstructStubCountdown)); 7868 set_construct_stub(builtins->builtin(Builtins::kJSConstructStubCountdown));
7867 // The map survived the gc, so there may be objects referencing it. 7869 // The map survived the gc, so there may be objects referencing it.
7868 set_live_objects_may_exist(true); 7870 set_live_objects_may_exist(true);
7869 } 7871 }
7870 7872
7871 7873
7874 void SharedFunctionInfo::ResetForNewContext(int new_ic_age) {
7875 code()->ClearInlineCaches();
7876 set_ic_age(new_ic_age);
7877 if (code()->kind() == Code::FUNCTION) {
7878 code()->set_profiler_ticks(0);
7879 if (optimization_disabled() &&
7880 opt_count() >= Compiler::kDefaultMaxOptCount) {
7881 // Re-enable optimizations if they were disabled due to opt_count limit.
7882 set_optimization_disabled(false);
7883 code()->set_optimizable(true);
7884 }
7885 set_opt_count(0);
7886 }
7887 }
7888
7889
7872 static void GetMinInobjectSlack(Map* map, void* data) { 7890 static void GetMinInobjectSlack(Map* map, void* data) {
7873 int slack = map->unused_property_fields(); 7891 int slack = map->unused_property_fields();
7874 if (*reinterpret_cast<int*>(data) > slack) { 7892 if (*reinterpret_cast<int*>(data) > slack) {
7875 *reinterpret_cast<int*>(data) = slack; 7893 *reinterpret_cast<int*>(data) = slack;
7876 } 7894 }
7877 } 7895 }
7878 7896
7879 7897
7880 static void ShrinkInstanceSize(Map* map, void* data) { 7898 static void ShrinkInstanceSize(Map* map, void* data) {
7881 int slack = *reinterpret_cast<int*>(data); 7899 int slack = *reinterpret_cast<int*>(data);
(...skipping 23 matching lines...) Expand all
7905 // Resize the initial map and all maps in its transition tree. 7923 // Resize the initial map and all maps in its transition tree.
7906 map->TraverseTransitionTree(&ShrinkInstanceSize, &slack); 7924 map->TraverseTransitionTree(&ShrinkInstanceSize, &slack);
7907 7925
7908 // Give the correct expected_nof_properties to initial maps created later. 7926 // Give the correct expected_nof_properties to initial maps created later.
7909 ASSERT(expected_nof_properties() >= slack); 7927 ASSERT(expected_nof_properties() >= slack);
7910 set_expected_nof_properties(expected_nof_properties() - slack); 7928 set_expected_nof_properties(expected_nof_properties() - slack);
7911 } 7929 }
7912 } 7930 }
7913 7931
7914 7932
7933 void SharedFunctionInfo::SharedFunctionInfoIterateBody(ObjectVisitor* v) {
7934 v->VisitSharedFunctionInfo(this);
7935 SharedFunctionInfo::BodyDescriptor::IterateBody(this, v);
7936 }
7937
7938
7915 #define DECLARE_TAG(ignore1, name, ignore2) name, 7939 #define DECLARE_TAG(ignore1, name, ignore2) name,
7916 const char* const VisitorSynchronization::kTags[ 7940 const char* const VisitorSynchronization::kTags[
7917 VisitorSynchronization::kNumberOfSyncTags] = { 7941 VisitorSynchronization::kNumberOfSyncTags] = {
7918 VISITOR_SYNCHRONIZATION_TAGS_LIST(DECLARE_TAG) 7942 VISITOR_SYNCHRONIZATION_TAGS_LIST(DECLARE_TAG)
7919 }; 7943 };
7920 #undef DECLARE_TAG 7944 #undef DECLARE_TAG
7921 7945
7922 7946
7923 #define DECLARE_TAG(ignore1, ignore2, name) name, 7947 #define DECLARE_TAG(ignore1, ignore2, name) name,
7924 const char* const VisitorSynchronization::kTagNames[ 7948 const char* const VisitorSynchronization::kTagNames[
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
7962 ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) && 7986 ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) &&
7963 rinfo->IsPatchedReturnSequence()) || 7987 rinfo->IsPatchedReturnSequence()) ||
7964 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && 7988 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) &&
7965 rinfo->IsPatchedDebugBreakSlotSequence())); 7989 rinfo->IsPatchedDebugBreakSlotSequence()));
7966 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); 7990 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address());
7967 Object* old_target = target; 7991 Object* old_target = target;
7968 VisitPointer(&target); 7992 VisitPointer(&target);
7969 CHECK_EQ(target, old_target); // VisitPointer doesn't change Code* *target. 7993 CHECK_EQ(target, old_target); // VisitPointer doesn't change Code* *target.
7970 } 7994 }
7971 7995
7972
7973 void ObjectVisitor::VisitEmbeddedPointer(RelocInfo* rinfo) { 7996 void ObjectVisitor::VisitEmbeddedPointer(RelocInfo* rinfo) {
7974 ASSERT(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT); 7997 ASSERT(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT);
7975 VisitPointer(rinfo->target_object_address()); 7998 VisitPointer(rinfo->target_object_address());
7976 } 7999 }
7977 8000
7978 void ObjectVisitor::VisitExternalReference(RelocInfo* rinfo) { 8001 void ObjectVisitor::VisitExternalReference(RelocInfo* rinfo) {
7979 Address* p = rinfo->target_reference_address(); 8002 Address* p = rinfo->target_reference_address();
7980 VisitExternalReferences(p, p + 1); 8003 VisitExternalReferences(p, p + 1);
7981 } 8004 }
7982 8005
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
8109 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); 8132 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
8110 for (RelocIterator it(this, mask); !it.done(); it.next()) { 8133 for (RelocIterator it(this, mask); !it.done(); it.next()) {
8111 RelocInfo* info = it.rinfo(); 8134 RelocInfo* info = it.rinfo();
8112 Object* object = info->target_object(); 8135 Object* object = info->target_object();
8113 if (object->IsMap()) return Map::cast(object); 8136 if (object->IsMap()) return Map::cast(object);
8114 } 8137 }
8115 return NULL; 8138 return NULL;
8116 } 8139 }
8117 8140
8118 8141
8142 void Code::ClearInlineCaches() {
8143 int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET) |
8144 RelocInfo::ModeMask(RelocInfo::CONSTRUCT_CALL) |
8145 RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID) |
8146 RelocInfo::ModeMask(RelocInfo::CODE_TARGET_CONTEXT);
8147 for (RelocIterator it(this, mask); !it.done(); it.next()) {
8148 RelocInfo* info = it.rinfo();
8149 Code* target(Code::GetCodeFromTargetAddress(info->target_address()));
8150 if (target->is_inline_cache_stub()) {
8151 IC::Clear(info->pc());
8152 }
8153 }
8154 }
8155
8156
8119 #ifdef ENABLE_DISASSEMBLER 8157 #ifdef ENABLE_DISASSEMBLER
8120 8158
8121 void DeoptimizationInputData::DeoptimizationInputDataPrint(FILE* out) { 8159 void DeoptimizationInputData::DeoptimizationInputDataPrint(FILE* out) {
8122 disasm::NameConverter converter; 8160 disasm::NameConverter converter;
8123 int deopt_count = DeoptCount(); 8161 int deopt_count = DeoptCount();
8124 PrintF(out, "Deoptimization Input Data (deopt points = %d)\n", deopt_count); 8162 PrintF(out, "Deoptimization Input Data (deopt points = %d)\n", deopt_count);
8125 if (0 == deopt_count) return; 8163 if (0 == deopt_count) return;
8126 8164
8127 PrintF(out, "%6s %6s %6s %6s %12s\n", "index", "ast id", "argc", "pc", 8165 PrintF(out, "%6s %6s %6s %6s %12s\n", "index", "ast id", "argc", "pc",
8128 FLAG_print_code_verbose ? "commands" : ""); 8166 FLAG_print_code_verbose ? "commands" : "");
(...skipping 4808 matching lines...) Expand 10 before | Expand all | Expand 10 after
12937 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 12975 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
12938 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 12976 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
12939 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 12977 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
12940 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 12978 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
12941 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 12979 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
12942 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 12980 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
12943 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 12981 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
12944 } 12982 }
12945 12983
12946 } } // namespace v8::internal 12984 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698