| OLD | NEW |
| 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 4985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4996 bool is_optimized = code->kind() == Code::OPTIMIZED_FUNCTION; | 4996 bool is_optimized = code->kind() == Code::OPTIMIZED_FUNCTION; |
| 4997 | 4997 |
| 4998 set_code(code); | 4998 set_code(code); |
| 4999 | 4999 |
| 5000 // Add/remove the function from the list of optimized functions for this | 5000 // Add/remove the function from the list of optimized functions for this |
| 5001 // context based on the state change. | 5001 // context based on the state change. |
| 5002 if (!was_optimized && is_optimized) { | 5002 if (!was_optimized && is_optimized) { |
| 5003 context()->native_context()->AddOptimizedFunction(this); | 5003 context()->native_context()->AddOptimizedFunction(this); |
| 5004 } | 5004 } |
| 5005 if (was_optimized && !is_optimized) { | 5005 if (was_optimized && !is_optimized) { |
| 5006 // TODO(titzer): linear in the number of optimized functions; fix! |
| 5006 context()->native_context()->RemoveOptimizedFunction(this); | 5007 context()->native_context()->RemoveOptimizedFunction(this); |
| 5007 } | 5008 } |
| 5008 } | 5009 } |
| 5009 | 5010 |
| 5010 | 5011 |
| 5011 Context* JSFunction::context() { | 5012 Context* JSFunction::context() { |
| 5012 return Context::cast(READ_FIELD(this, kContextOffset)); | 5013 return Context::cast(READ_FIELD(this, kContextOffset)); |
| 5013 } | 5014 } |
| 5014 | 5015 |
| 5015 | 5016 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5258 | 5259 |
| 5259 | 5260 |
| 5260 void Code::set_type_feedback_info(Object* value, WriteBarrierMode mode) { | 5261 void Code::set_type_feedback_info(Object* value, WriteBarrierMode mode) { |
| 5261 ASSERT(kind() == FUNCTION); | 5262 ASSERT(kind() == FUNCTION); |
| 5262 WRITE_FIELD(this, kTypeFeedbackInfoOffset, value); | 5263 WRITE_FIELD(this, kTypeFeedbackInfoOffset, value); |
| 5263 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kTypeFeedbackInfoOffset, | 5264 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kTypeFeedbackInfoOffset, |
| 5264 value, mode); | 5265 value, mode); |
| 5265 } | 5266 } |
| 5266 | 5267 |
| 5267 | 5268 |
| 5269 Object* Code::next_code_link() { |
| 5270 CHECK(kind() == OPTIMIZED_FUNCTION); |
| 5271 return Object::cast(READ_FIELD(this, kTypeFeedbackInfoOffset)); |
| 5272 } |
| 5273 |
| 5274 |
| 5275 void Code::set_next_code_link(Object* value, WriteBarrierMode mode) { |
| 5276 CHECK(kind() == OPTIMIZED_FUNCTION); |
| 5277 WRITE_FIELD(this, kTypeFeedbackInfoOffset, value); |
| 5278 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kTypeFeedbackInfoOffset, |
| 5279 value, mode); |
| 5280 } |
| 5281 |
| 5282 |
| 5268 int Code::stub_info() { | 5283 int Code::stub_info() { |
| 5269 ASSERT(kind() == COMPARE_IC || kind() == COMPARE_NIL_IC || | 5284 ASSERT(kind() == COMPARE_IC || kind() == COMPARE_NIL_IC || |
| 5270 kind() == BINARY_OP_IC || kind() == LOAD_IC); | 5285 kind() == BINARY_OP_IC || kind() == LOAD_IC); |
| 5271 Object* value = READ_FIELD(this, kTypeFeedbackInfoOffset); | 5286 Object* value = READ_FIELD(this, kTypeFeedbackInfoOffset); |
| 5272 return Smi::cast(value)->value(); | 5287 return Smi::cast(value)->value(); |
| 5273 } | 5288 } |
| 5274 | 5289 |
| 5275 | 5290 |
| 5276 void Code::set_stub_info(int value) { | 5291 void Code::set_stub_info(int value) { |
| 5277 ASSERT(kind() == COMPARE_IC || | 5292 ASSERT(kind() == COMPARE_IC || |
| 5278 kind() == COMPARE_NIL_IC || | 5293 kind() == COMPARE_NIL_IC || |
| 5279 kind() == BINARY_OP_IC || | 5294 kind() == BINARY_OP_IC || |
| 5280 kind() == STUB || | 5295 kind() == STUB || |
| 5281 kind() == LOAD_IC || | 5296 kind() == LOAD_IC || |
| 5282 kind() == KEYED_LOAD_IC || | 5297 kind() == KEYED_LOAD_IC || |
| 5283 kind() == STORE_IC || | 5298 kind() == STORE_IC || |
| 5284 kind() == KEYED_STORE_IC); | 5299 kind() == KEYED_STORE_IC); |
| 5285 WRITE_FIELD(this, kTypeFeedbackInfoOffset, Smi::FromInt(value)); | 5300 WRITE_FIELD(this, kTypeFeedbackInfoOffset, Smi::FromInt(value)); |
| 5286 } | 5301 } |
| 5287 | 5302 |
| 5288 | 5303 |
| 5289 Object* Code::code_to_deoptimize_link() { | |
| 5290 // Optimized code should not have type feedback. | |
| 5291 ASSERT(kind() == OPTIMIZED_FUNCTION); | |
| 5292 return READ_FIELD(this, kTypeFeedbackInfoOffset); | |
| 5293 } | |
| 5294 | |
| 5295 | |
| 5296 void Code::set_code_to_deoptimize_link(Object* value) { | |
| 5297 ASSERT(kind() == OPTIMIZED_FUNCTION); | |
| 5298 WRITE_FIELD(this, kTypeFeedbackInfoOffset, value); | |
| 5299 } | |
| 5300 | |
| 5301 | |
| 5302 Object** Code::code_to_deoptimize_link_slot() { | |
| 5303 ASSERT(kind() == OPTIMIZED_FUNCTION); | |
| 5304 return HeapObject::RawField(this, kTypeFeedbackInfoOffset); | |
| 5305 } | |
| 5306 | |
| 5307 | |
| 5308 ACCESSORS(Code, gc_metadata, Object, kGCMetadataOffset) | 5304 ACCESSORS(Code, gc_metadata, Object, kGCMetadataOffset) |
| 5309 INT_ACCESSORS(Code, ic_age, kICAgeOffset) | 5305 INT_ACCESSORS(Code, ic_age, kICAgeOffset) |
| 5310 | 5306 |
| 5311 | 5307 |
| 5312 byte* Code::instruction_start() { | 5308 byte* Code::instruction_start() { |
| 5313 return FIELD_ADDR(this, kHeaderSize); | 5309 return FIELD_ADDR(this, kHeaderSize); |
| 5314 } | 5310 } |
| 5315 | 5311 |
| 5316 | 5312 |
| 5317 byte* Code::instruction_end() { | 5313 byte* Code::instruction_end() { |
| (...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6284 #undef WRITE_UINT32_FIELD | 6280 #undef WRITE_UINT32_FIELD |
| 6285 #undef READ_SHORT_FIELD | 6281 #undef READ_SHORT_FIELD |
| 6286 #undef WRITE_SHORT_FIELD | 6282 #undef WRITE_SHORT_FIELD |
| 6287 #undef READ_BYTE_FIELD | 6283 #undef READ_BYTE_FIELD |
| 6288 #undef WRITE_BYTE_FIELD | 6284 #undef WRITE_BYTE_FIELD |
| 6289 | 6285 |
| 6290 | 6286 |
| 6291 } } // namespace v8::internal | 6287 } } // namespace v8::internal |
| 6292 | 6288 |
| 6293 #endif // V8_OBJECTS_INL_H_ | 6289 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |