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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 global->native_context()->script_context_table()); | 1551 global->native_context()->script_context_table()); |
1552 | 1552 |
1553 ScriptContextTable::LookupResult lookup_result; | 1553 ScriptContextTable::LookupResult lookup_result; |
1554 if (ScriptContextTable::Lookup(script_contexts, str_name, &lookup_result)) { | 1554 if (ScriptContextTable::Lookup(script_contexts, str_name, &lookup_result)) { |
1555 Handle<Context> script_context = ScriptContextTable::GetContext( | 1555 Handle<Context> script_context = ScriptContextTable::GetContext( |
1556 script_contexts, lookup_result.context_index); | 1556 script_contexts, lookup_result.context_index); |
1557 if (lookup_result.mode == CONST) { | 1557 if (lookup_result.mode == CONST) { |
1558 return TypeError("const_assign", object, name); | 1558 return TypeError("const_assign", object, name); |
1559 } | 1559 } |
1560 | 1560 |
| 1561 Handle<Object> previous_value = |
| 1562 FixedArray::get(script_context, lookup_result.slot_index); |
| 1563 |
| 1564 if (*previous_value == *isolate()->factory()->the_hole_value()) { |
| 1565 // Do not install stubs and stay pre-monomorphic for |
| 1566 // uninitialized accesses. |
| 1567 return ReferenceError("not_defined", name); |
| 1568 } |
| 1569 |
1561 if (FLAG_use_ic && | 1570 if (FLAG_use_ic && |
1562 StoreScriptContextFieldStub::Accepted(&lookup_result)) { | 1571 StoreScriptContextFieldStub::Accepted(&lookup_result)) { |
1563 StoreScriptContextFieldStub stub(isolate(), &lookup_result); | 1572 StoreScriptContextFieldStub stub(isolate(), &lookup_result); |
1564 PatchCache(name, stub.GetCode()); | 1573 PatchCache(name, stub.GetCode()); |
1565 } | 1574 } |
1566 | 1575 |
1567 script_context->set(lookup_result.slot_index, *value); | 1576 script_context->set(lookup_result.slot_index, *value); |
1568 return value; | 1577 return value; |
1569 } | 1578 } |
1570 } | 1579 } |
(...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3055 static const Address IC_utilities[] = { | 3064 static const Address IC_utilities[] = { |
3056 #define ADDR(name) FUNCTION_ADDR(name), | 3065 #define ADDR(name) FUNCTION_ADDR(name), |
3057 IC_UTIL_LIST(ADDR) NULL | 3066 IC_UTIL_LIST(ADDR) NULL |
3058 #undef ADDR | 3067 #undef ADDR |
3059 }; | 3068 }; |
3060 | 3069 |
3061 | 3070 |
3062 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 3071 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
3063 } | 3072 } |
3064 } // namespace v8::internal | 3073 } // namespace v8::internal |
OLD | NEW |