| 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 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 location, | 687 location, |
| 688 "Not a native context") && | 688 "Not a native context") && |
| 689 Utils::ApiCheck(index >= 0, location, "Negative index"); | 689 Utils::ApiCheck(index >= 0, location, "Negative index"); |
| 690 if (!ok) return i::Handle<i::FixedArray>(); | 690 if (!ok) return i::Handle<i::FixedArray>(); |
| 691 i::Handle<i::FixedArray> data(env->embedder_data()); | 691 i::Handle<i::FixedArray> data(env->embedder_data()); |
| 692 if (index < data->length()) return data; | 692 if (index < data->length()) return data; |
| 693 if (!Utils::ApiCheck(can_grow, location, "Index too large")) { | 693 if (!Utils::ApiCheck(can_grow, location, "Index too large")) { |
| 694 return i::Handle<i::FixedArray>(); | 694 return i::Handle<i::FixedArray>(); |
| 695 } | 695 } |
| 696 int new_size = i::Max(index, data->length() << 1) + 1; | 696 int new_size = i::Max(index, data->length() << 1) + 1; |
| 697 data = env->GetIsolate()->factory()->CopySizeFixedArray(data, new_size); | 697 data = i::FixedArray::CopySize(data, new_size); |
| 698 env->set_embedder_data(*data); | 698 env->set_embedder_data(*data); |
| 699 return data; | 699 return data; |
| 700 } | 700 } |
| 701 | 701 |
| 702 | 702 |
| 703 v8::Local<v8::Value> Context::SlowGetEmbedderData(int index) { | 703 v8::Local<v8::Value> Context::SlowGetEmbedderData(int index) { |
| 704 const char* location = "v8::Context::GetEmbedderData()"; | 704 const char* location = "v8::Context::GetEmbedderData()"; |
| 705 i::Handle<i::FixedArray> data = EmbedderDataFor(this, index, false, location); | 705 i::Handle<i::FixedArray> data = EmbedderDataFor(this, index, false, location); |
| 706 if (data.is_null()) return Local<Value>(); | 706 if (data.is_null()) return Local<Value>(); |
| 707 i::Handle<i::Object> result(data->get(index), data->GetIsolate()); | 707 i::Handle<i::Object> result(data->get(index), data->GetIsolate()); |
| (...skipping 6896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7604 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7604 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7605 Address callback_address = | 7605 Address callback_address = |
| 7606 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7606 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7607 VMState<EXTERNAL> state(isolate); | 7607 VMState<EXTERNAL> state(isolate); |
| 7608 ExternalCallbackScope call_scope(isolate, callback_address); | 7608 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7609 callback(info); | 7609 callback(info); |
| 7610 } | 7610 } |
| 7611 | 7611 |
| 7612 | 7612 |
| 7613 } } // namespace v8::internal | 7613 } } // namespace v8::internal |
| OLD | NEW |